Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: How to assign an object to another in it method? Date: Thu, 13 Jul 2017 15:01:51 -0400 Organization: Aioe.org NNTP Server Lines: 20 Message-ID: References: <46334961-cc18-491f-828c-32e7401c7832@googlegroups.com> NNTP-Posting-Host: PBuS014lhzVyHjLbXmo/ZQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:36911 On 7/13/2017 2:09 PM, Andreas Leitgeb wrote: > 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. I consider overriding a method and unconditionally throw an exception toe be removing. > An IntelligentPerson doesn't smoke(), so its class might > "remove" the smoke() method. Maybe Person should not have had a smoke methods in the first place since all persons do not smoke. Arne