# list0205.rb # アクセサ その2 class Point def initialize( x, y ) @x = x @y = y end def show print "(",@x,",",@y,")\n" end def x return @x end def x=(value) @x = value end end p1 = Point.new(1,2) puts p1.x p1.x = 5 p1.show