Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Drawing a hierarchy w.r.t. class (instance) variables
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Minkoo Seo, post: 4506859"] Hi group. Recently, I've read [URL]http://www.visibleworkings.com/little-ruby/Chapter3.pdf[/URL] [URL]http://www.ruby-doc.org/docs/Understanding%20Ruby's%20Object%20Model/ChrisPine_UROM.ppt[/URL] and PickAxe. I'm trying to draw a picture of hierarchy for the following: class Foo @@k = 20 end class Bar < Foo @j = 10 def initialize @i = 0 end end b = Bar.new I understand how to draw hierarchy if it were not for class variables: Class ^ | +-------+ | | (Foo) <-(Bar) ^ ^ - Bar's class methods | | Foo <- Bar ^ - j and Bar's instance methods | b - i In this picture parenthesis represents meta class. Upward arrows represents 'class', while leftward arrows represents 'inherits'. But, I have no idead where the class variable k should belong to. k is shared by Foo and Bar which menas that if k is modified at Foo, then the value of k at Bar will be modified also. That being the case, does k must be drawn under (Foo)? or Class? Thanks. - Minkoo Seo [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Drawing a hierarchy w.r.t. class (instance) variables
Top