Last active
September 16, 2020 04:42
-
-
Save codetombomb/4f068070e939c57ecf977c7fc291dfbc to your computer and use it in GitHub Desktop.
Another Example for instance of self
This file contains hidden or 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 :color, :year, :make, :model | |
def initialize(color, year, make, model) | |
@color = color | |
@year = year | |
@make = make | |
@model = model | |
end | |
def get_vin | |
puts self | |
end | |
def years_old | |
Time.now.year - self.year | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment