Created
June 9, 2016 19:54
-
-
Save ty-shaikh/88b3dbca21effcf6d604a1d236a6fe56 to your computer and use it in GitHub Desktop.
OOP Practice
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 | |
attr_accessor :brand, :model | |
def initialize(brand, model) | |
@brand = brand | |
@model = model | |
end | |
def name | |
puts "#{self.brand} #{self.model}" | |
end | |
end | |
car = Car.new("Toyota", "Camry") | |
car.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment