Created
July 16, 2013 08:38
-
-
Save perfectfoolish/6006946 to your computer and use it in GitHub Desktop.
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(name, age) | |
@name = name | |
@age = age | |
end | |
public # This method can be called from outside the class. | |
def about_me | |
puts "I'm #{@name} and I'm #{@age} years old!" | |
end | |
private # This method can't! | |
def bank_account_number | |
@account_number = 12345 | |
puts "My bank account number is #{@account_number}." | |
end | |
end | |
eric = Person.new("Eric", 26) | |
eric.about_me | |
eric.bank_account_number |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment