R
Roger Pack
This confused me a bit
class A
@a = 2
@@a = 3
def self.a
puts [@a, @@a]
end
end
class B < A; end
A.a # [2, 3]
B.a # [nil, 3]
shouldn't @a just lookup @@a in the parent? Different treatment for
different types of variables?
-r
class A
@a = 2
@@a = 3
def self.a
puts [@a, @@a]
end
end
class B < A; end
A.a # [2, 3]
B.a # [nil, 3]
shouldn't @a just lookup @@a in the parent? Different treatment for
different types of variables?
-r