Created
March 20, 2010 20:56
-
-
Save simeonwillbanks/338901 to your computer and use it in GitHub Desktop.
#Ruby Property Accessors Person
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 Person | |
def initialize(first_name, last_name) | |
@first_name = first_name | |
@last_name = last_name | |
end | |
# access method | |
def full_name | |
"%s %s" % [@first_name, @last_name] | |
end | |
end | |
me = Person.new("Simeon", "Willbanks") | |
# so clean! | |
puts me.full_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment