Ruby - Class Methods and Variables
Given the following Ruby code:
What will be the output?
class X
@@counter = 0
def initialize
@@counter += 1
end
def self.counter
@@counter
end
end
class Y < X; end
X.new
Y.new
Y.new
puts Y.counterWhat will be the output?
