Last active
August 29, 2015 13:57
-
-
Save corecode/9872999 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.0.0-p247 :021 > class A;end | |
=> nil | |
2.0.0-p247 :022 > class B<A;end | |
=> nil | |
2.0.0-p247 :023 > A.class_variable_get(:@@f) | |
NameError: uninitialized class variable @@f in A | |
from (irb):23:in `class_variable_get' | |
from (irb):23 | |
from /home/2/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `<main>' | |
2.0.0-p247 :024 > A.class_variable_set(:@@f, 1) | |
=> 1 | |
2.0.0-p247 :025 > B.class_variable_get(:@@f) | |
=> 1 | |
2.0.0-p247 :026 > B.class_variable_set(:@@f, 2) | |
=> 2 | |
2.0.0-p247 :027 > A.class_variable_get(:@@f) | |
=> 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment