class Layton
@location
attr_accessor :location
def initialize
@location = false
end
def crossRiver
@location = true
end
end
layton = Layton.new() layton.crossRiver if !layton.location print "FAIL" end
class Layton
@location
attr_accessor :location
def initialize
@location = false
end
def crossRiver
@location = !@location
end
end
class Solver
def run(person)
person.crossRiver
end
end
solver = Solver.new() layton = Layton.new() solver.run(layton) if !layton.location print "FAIL" end