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