🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: ibm.software.vajava.language
Article #8

Re: How to make a member variable of a derivation read-only?

#8
From: Noelle Adam
Date: Mon, 06 Mar 2000 00:00
30 lines
2139 bytes

Jon Skeet 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.

>
> > If you know a solution to this problem, please submit
> > it to http://www.the-codebook.com/show_code.asp?ProblemId=1356
>
> Post in news, expect answers in news...
>
> --
> Jon Skeet - skeet@pobox.com
> http://www.pobox.com/~skeet/

--
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
TīŋŊl: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
Technical Details
Message-ID: <38C3E129.94E2617A@irisa.fr>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <951828737327@munich.ixos.de> <MPG.1325eec3ad14ad23989eec@news>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 100145,d86be700aa9afbe6
X-Google-Attributes: gid100145,public
X-Google-Thread: fbe9c,d86be700aa9afbe6
X-Google-Attributes: gidfbe9c,public
X-Google-Thread: 114aa0,d86be700aa9afbe6
X-Google-Attributes: gid114aa0,public
X-Google-Thread: 10a146,d86be700aa9afbe6
X-Google-Attributes: gid10a146,public
X-Google-Thread: f74b3,d86be700aa9afbe6
X-Google-Attributes: gidf74b3,public
X-Google-Thread: 113ae9,d86be700aa9afbe6
X-Google-Attributes: gid113ae9,public
From: Noelle Adam <Noelle.Adam@irisa.fr>
Subject: Re: How to make a member variable of a derivation read-only?
Date: 2000/03/06
Message-ID: <38C3E129.94E2617A@irisa.fr>
X-Deja-AN: 593873256
Content-Transfer-Encoding: 8bit
References: <951828737327@munich.ixos.de> <MPG.1325eec3ad14ad23989eec@news>
X-Accept-Language: en,fr
Content-Type: text/plain; charset=iso-8859-1
X-Complaints-To: usenet@irisa.fr
X-Trace: news.irisa.fr 952361256 4162 131.254.60.98 (6 Mar 2000 16:47:36 GMT)
Organization: Irisa, Rennes (FR)
Mime-Version: 1.0
NNTP-Posting-Date: 6 Mar 2000 16:47:36 GMT
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