Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Created September 24, 2018 06:15
Show Gist options
  • Save harrisonmalone/96f3fe150e145caf0b9dbbc389538737 to your computer and use it in GitHub Desktop.
Save harrisonmalone/96f3fe150e145caf0b9dbbc389538737 to your computer and use it in GitHub Desktop.
class Car
attr_accessor :colour
attr_reader :make
def initialize(make, colour)
@make = make
@colour = colour
end
def car_start
"Vrooom!"
end
end
holden = Car.new("Holden", "Red")
ford = Car.new("Ford", "Blue")
bmw = Car.new("BMW", "Silver")
p holden.make
p ford.make
p bmw.colour
bmw.colour = "Gold"
p bmw.colour
p bmw.car_start
p holden.car_start
p holden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment