Skip to content

Instantly share code, notes, and snippets.

@Murphydbuffalo
Created June 1, 2014 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Murphydbuffalo/cd240aa371a7ce07c349 to your computer and use it in GitHub Desktop.
Save Murphydbuffalo/cd240aa371a7ce07c349 to your computer and use it in GitHub Desktop.
Getter methods (OOD reading)
class Car
def initialize(color, owner, cylinders)
@color = color
@owner = owner
@cylinders = cylinders
end
def color
@color
end
def owner
@owner
end
def cylinders
@cylinders
end
end
dans_car = Car.new('black', 'Dan', 4)
dans_car.color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment