Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Andreas Leitgeb Newsgroups: comp.lang.java.programmer Subject: Re: How to assign an object to another in it method? Date: Thu, 13 Jul 2017 18:09:30 -0000 (UTC) Organization: A noiseless patient Spider Lines: 18 Message-ID: References: <46334961-cc18-491f-828c-32e7401c7832@googlegroups.com> Reply-To: avl@logic.at Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 13 Jul 2017 18:09:30 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="891ec2ce37e0ba46fd2b2385f5ad4a6c"; logging-data="18361"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18l5unxNW0eX3DTsPUPy5e9" User-Agent: slrn/1.0.2 (Linux) Cancel-Lock: sha1:qzdtTVKuT9kiCOsja8vLZbKrpuQ= Xref: csiph.com comp.lang.java.programmer:36907 Arne Vajhøj wrote: > I am objecting two these two: > >>>> Ideally, a subclass should be allowed to "remove" methods > >>> In this case why wouldn't you override Rectangle.setDimensions() with a > >>> variant that throws an exception if the two dimensions differ > Sub classes should not remove functionality. Maybe there's still some confusion about what "removing" means here. An IntelligentPerson doesn't smoke(), so its class might "remove" the smoke() method. But if an IntelligentPerson is required to do undercover investigations, it might eventually disguise itself as a SimplePerson and in that situation it might even smoke() to mimic the target milieu. (It might have a special dummy implementation of smoke(), though, for that matter.)