[Chunky_bacon] instance variables not inherited?
travis+ml-chunky-bacon at subspacefield.org
travis+ml-chunky-bacon at subspacefield.org
Wed Jul 6 19:54:24 UTC 2011
So I'm confused.
I have a class, A, and a class B which subclasses from it.
In A's initializer, I set an instance variable foo.
In A's methods, I can access it very easily.
But in B's methods, if I try to access it, it's undefined.
What is the correct idiom for this?
Oh...
http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_classes.html
I have to write an accessor. Hmm. Just letting you guys know, this
is kind of non-obvious, IMHO. It makes sense to decouple from a parent
class's implementation, but many other OOPLs allow children to muck
about in the parent implementation as if it were their own.
--
http://www.subspacefield.org/~travis/ | Meijin ni joseki nashi
"Who wants flowers when you're dead? Nobody." -- Catcher in the Rye
If you are a spammer, please email john at subspacefield.org to get blacklisted.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://www.noisebridge.net/pipermail/chunky_bacon/attachments/20110706/6bffdcb1/attachment-0002.sig>
More information about the Chunky_bacon
mailing list