Created
November 21, 2016 15:13
-
-
Save jordanpoulton/ab8f77973688c1c3ec59420064221c84 to your computer and use it in GitHub Desktop.
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 Person | |
def initialize(name, age) | |
@name = name | |
@age = age | |
end | |
def name | |
@name | |
end | |
def name=(new_name) | |
@name = new_name | |
end | |
end | |
jordan = Person.new(‘Jordan’, 31) | |
puts jordan.name # => “Jordan” | |
jordan.name = “Mr Poulton” | |
puts jordan.name # => “Mr Poulton” |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment