Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Car
- attr_reader :num_of_tires
- attr_accessor :miles_per_hour, :color
- def initialize(color)
- @color = color
- @num_of_tires = 4
- end
- def drive(miles_per_hour)
- p "This car can drive #{miles_per_hour} mph!"
- end
- end
- honda = Car.new("red")
- honda.color
- honda.num_of_tires
- honda.miles_per_hour = 50
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement