# prac0202.rb # 2次元座標クラス その2 class Point def initialize( x, y ) @x = x @y = y end def show print "(",@x,",",@y,")\n" end def distance return Math::sqrt(@x*@x+@y*@y) end end p1 = Point.new(3,4) puts p1.distance