[plt-scheme] inheritance of private fields?
Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
> On Feb 29, 2008, at 5:31 PM, tom sgouros wrote:
>
> > This makes sense, and I maybe see what you're driving at with it.
> > Is it
> > correct to say that I should forget about what I was trying to do
> > (inherit the name and change the value) and just hide the data value I
> > have behind some accessor function and inherit that, as you do here?
>
>
> The field plus inherit-field parts were the essence. The accessor
> functions are a bad teaching ingredient. Sorry, I should do better.
But the field plus inherit-field is the easy part. What I can't seem to
do is to change the value of that field in the daughter class. I wanted
a class that had essentially a default value for a bunch of parameters,
and sub-classes would override some of those fields, and leave others
alone.
Perhaps I'm not thinking of this right. I thought the fields were
variables I could address. Perhaps I should think of them as constants?
Like "final" in Java?
> When you define something, it's hidden for good -- Matthias
Ok, that's clear.
Thanks,
-tom
--
------------------------
tomfool at as220 dot org
http://sgouros.com
http://whatcheer.net