mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-04-29 11:33:36 +00:00
23 lines
450 B
Ruby
23 lines
450 B
Ruby
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 |