Created
February 12, 2016 00:24
-
-
Save peterxjang/e9b69b4de36b2c41ef4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car | |
def initialize | |
@speed = 0 | |
@direction = 'north' | |
end | |
def brake | |
@speed = 0 | |
end | |
def accelerate | |
@speed += 10 | |
end | |
def turn(new_direction) | |
@direction = new_direction | |
end | |
def honk_horn | |
puts "Beeeeeeep!" | |
end | |
end | |
class Bike | |
def initialize | |
@speed = 0 | |
@direction = 'north' | |
end | |
def brake | |
@speed = 0 | |
end | |
def accelerate | |
@speed += 10 | |
end | |
def turn(new_direction) | |
@direction = new_direction | |
end | |
def ring_bell | |
puts "Ring ring!" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment