Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: Accessibility of suBclass-fields from suPERclass (reflection) Date: Sun, 17 Aug 2014 07:54:34 -0400 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: <53eecf6a$0$300$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 17 Aug 2014 11:54:35 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="bd4e1cba8d8592bec5d5ed9e4537fbfd"; logging-data="1921"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+1yjjo2kriGgtiBlS2ylb6" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 In-Reply-To: Cancel-Lock: sha1:8/XZ2SpE4TeHr97/u/ON/wWXntQ= Xref: csiph.com comp.lang.java.programmer:29706 On 8/17/2014 6:51 AM, Josip Almasi wrote: > On 08/17/2014 02:22 AM, Eric Sosman wrote: >> On 8/16/2014 6:37 PM, Andreas Leitgeb wrote: >>> Overall-operations, (e.g. resetting all values of a given subclass >>> instance) are done from Base-class by use of reflection. >> >> Why by reflection? Why not by a reset() method, abstract in >> the superclass? > > Because it means coding in each subclass? Hmmm. I suppose that would be a possible objection, but it seems kind of far-fetched. Nobody seems too terribly upset about writing a separate equals() for every subclass that needs one; why should a reset() method be more objectionable? Awful thought: A subclass that inherits equals() from its superclass, where the superclass' equals() implementation uses reflection to inspect the subclass' innards ... -- esosman@comcast-dot-net.invalid