[Newbies] Question about inheritance
shortoneskanda at yahoo.com
Fri Oct 13 13:57:24 UTC 2006
I'm a newbie trying to get my head around inheritance. I'm puzzled by the following example. It seems to do what I mean, but not what I type ;) This is a good thing, but I'd get further if I understood the semantics a bit better.
Category: Sesame Street
Instance variables: colour tummy
self colour: #green.
self tummy: Bag new
"There is only a single class method and no class variables."
^ super new initialize
What I don't understand is this: Monster new returns an instance of Monster, what you'd want it to. But Monster new executes "^ super new" which to my mind should return an instance of Object, not Monster. Just to confuse myself further, I typed:
Monster superclass new
and got an Object. It seems to me that "super new" and "superclass new" should do the same thing.
Any points to clarify my confusion would be greatly appreciated.
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners