Created
June 25, 2013 03:44
-
-
Save cjavdev/5855773 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Tracker | |
@tracked_items = [] | |
def initialize | |
Tracker.tracked_items << self | |
end | |
def self.tracked_items | |
@tracked_items | |
end | |
end | |
class Tracked < Tracker | |
def initialize | |
super | |
end | |
end | |
x = Tracked.new | |
y = Tracked.new | |
p Tracker.tracked_items |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment