Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo
- @foo_count = 0 <---- instance variable
- def self.increment_counter <---- class method
- @foo_count += 1
- end
- def self.current_count
- @foo_count
- end
- end
- class Bar < Foo
- @foo_count = 100
- end
- Foo.increment_counter <---- how class method can access to instance variable?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement