Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo
- # Write the instance variable foo into the class Foo
- @@foo = 14
- x = Foo.new
- def x.foo
- # Reads the instance variable foo from the class of Self, which is Foo
- puts @@foo
- end
- x.foo
- def self.foo
- # Reads the instance variable foo from self
- puts @@foo
- end
- self.foo
- end
- puts Foo.foo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement