Revision: 5322
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 28, 2008 04:04 by zippoter
Initial Code
class App
$super_count = 111
@@count = 0
def initialize (caller)
@call = caller
end
# instance method
def callme
p “called using #{@call}â€
@@count+=1
end
# class method
def App.callmetoo
p “called using callmetooâ€
@@count+=1
end
end
obj1 = App.new(â€OBJECT1″)
obj2 = App.new(â€OBJECT2″)
p obj1.callme
p obj2.callme
p App.callmetoo
p $super_count #can be access outside the class
#p App.@@count #cant access outside the class
Initial URL
Initial Description
Initial Title
instance variable vs class variable
Initial Tags
Initial Language
Ruby