Article View: ibm.software.vajava.language
Article #9Re: How to make a member variable of a derivation read-only?
From: Jon Skeet
Date: Mon, 06 Mar 2000 00:00
Date: Mon, 06 Mar 2000 00:00
21 lines
1814 bytes
1814 bytes
Noelle.Adam@irisa.fr wrote: > > Hannes.Heckner@munich.ixos.de wrote: > > > > > How can I make foo final in the derivation by OVERLOADING > > > foo from the Base class? > > > > You can't. Variables aren't overridden, they are merely shadowed. > > (Overloading is something different, by the way.) The Java Language > > Specification explains this in more detail. > > Yes, what you can do is create an accessor method for a private variable > and override it in the descendant class. That's still not overloading foo. I may be a way round the problem, but the specific qusetion "How can I make foo final [...] by overloading foo [...]" still has the answer "You can't." -- Jon Skeet - skeet@pobox.com http://www.pobox.com/~skeet/
Technical Details
Message-ID:
<MPG.132df515f57a94d5989f34@news>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<951828737327@munich.ixos.de> <MPG.1325eec3ad14ad23989eec@news> <38C3E129.94E2617A@irisa.fr>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113ae9,d86be700aa9afbe6 X-Google-Attributes: gid113ae9,public X-Google-Thread: 100145,d86be700aa9afbe6 X-Google-Attributes: gid100145,public X-Google-Thread: f74b3,d86be700aa9afbe6 X-Google-Attributes: gidf74b3,public X-Google-Thread: 114aa0,d86be700aa9afbe6 X-Google-Attributes: gid114aa0,public X-Google-Thread: fbe9c,d86be700aa9afbe6 X-Google-Attributes: gidfbe9c,public X-Google-Thread: 10a146,d86be700aa9afbe6 X-Google-Attributes: gid10a146,public From: Jon Skeet <skeet@pobox.com> Subject: Re: How to make a member variable of a derivation read-only? Date: 2000/03/06 Message-ID: <MPG.132df515f57a94d5989f34@news> X-Deja-AN: 593875786 References: <951828737327@munich.ixos.de> <MPG.1325eec3ad14ad23989eec@news> <38C3E129.94E2617A@irisa.fr> X-Trace: flex.news.uk.uu.net 952362143 18026 Newsgroups: ibm.software.vajava.language,borland.public.jbuilder.java.language,borland.public.jbuilder.java,microsoft.public.java.visualj++,comp.lang.java.help,comp.lang.java.programmer