Article View: borland.public.jbuilder.java.language
Article #15027Re: Illogical constructor behaviour?
From: Tom.Eugelink
Date: Tue, 13 Jul 1999 00:00
Date: Tue, 13 Jul 1999 00:00
23 lines
1439 bytes
1439 bytes
On 12 Jul 1999 12:16:12 +0200, Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no> wrote: >Tom.Eugelink@OVSoftware.com writes: > >> It seems to me there is no reason why the declares shouldn't be >> executed when the constructor is entered instead of just before the >> first line in the constructor... > >Your _actual_ problem is that fireman.display() _masks_ >person.display(), and methods are invoked dynamically. Oh, I understand what is going wrong and the logic behind it. But that still does not convince me that it is the best solution. Afterall, I did enter the constructor of the fireman class, so I feel that that is enough reason to have all instance variables not only allocated but also declared. I now had to resort to an if statement in each constructor checking the name of the class against a (hardcoded) value to see if I am at toplevel and can make the display call safely. (And that is coding I consider, eh, rude... ;-) Tom
Technical Details
Message-ID:
<378adee2.3105084@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3789a7ea.1163072@forums.inprise.com> <uzp1241hv.fsf@sds.no>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,c150801d0979e255 X-Google-Attributes: gidf74b3,public From: Tom.Eugelink@OVSoftware.com Subject: Re: Illogical constructor behaviour? Date: 1999/07/13 Message-ID: <378adee2.3105084@forums.inprise.com> X-Deja-AN: 500415236 References: <3789a7ea.1163072@forums.inprise.com> <uzp1241hv.fsf@sds.no> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language