Ruby 初心者スレッド Part 33
■ このスレッドは過去ログ倉庫に格納されています
0481デフォルトの名無しさん
2009/12/28(月) 22:07:20class My
attr_reader :position
def initialize ; @position = Point.new ; end
def position=(xyz)
@position.x,@position.y,@position.z = xyz # 要引数チェック
end
end
my = My.new
my.position = [0,0,0]
pos = my.position
my.position.x = pos.x + 1
■ このスレッドは過去ログ倉庫に格納されています