Ruby - Classes and Objects
Consider this Ruby class:
class Counter
def initialize
@count = 0
end
def increment
@count += 1
end
def reset
@count = 0
end
def current
@count
end
end
What will be the output after this code?
c = Counter.new
c.increment
c.increment
puts c.current
c.reset
puts c.current
