I am getting stack level too deep (SystemStackError) when I run ruby lib/interface.rb and I dont understand why this is happening.
This is my car.rb file:
class Car
def initialize(color, year, second_hand)
@color = color
@year = year
@second_hand = second_hand
end
def color
return color
end
def year
return year
end
def second_hand?
return second_hand
end
end
and this is my interface.rb:
require_relative "car"
my_car = Car.new("red", "1988", false)
puts my_car.color
Thanks a lot in advance for your help!