23 lines
287 B
Ruby
Executable File
23 lines
287 B
Ruby
Executable File
#!/usr/bin/ruby
|
|
# -*- coding: utf-8 -*-
|
|
|
|
=begin
|
|
나이 증가 메서드
|
|
=end
|
|
|
|
class Person
|
|
attr_accessor :name, :age
|
|
|
|
def initialize(name, age)
|
|
@name = name
|
|
@age = age
|
|
end
|
|
|
|
def grow_up
|
|
@age += 1
|
|
end
|
|
end
|
|
|
|
charlie = Person.new("Charlie", 13)
|
|
charlie.grow_up
|
|
p charlie |