Task

Create two classes   Point(x,y)   and   Circle(x,y,r)   with a polymorphic function print, accessors for (x,y,r), copy constructor, assignment and destructor and every possible default constructors




class Point{var x,y;
   fcn init(xyOrPoint=0,_=0){
      if(Point.isInstanceOf(xyOrPoint)) set(xyOrPoint); 
      else x,y=vm.arglist.apply("toFloat")}
   fcn set(p){x=p.x;y=p.y}
   fcn toString{"(%d,%d)".fmt(x,y)}
}
class Circle{var center, radius;
   fcn init(a=0.0,b=0.0,r=1.0){
      switch [arglist]{
         case(Circle){ center=Point(a.center); radius=a.radius }
	 case(Point) { center=Point(a); radius=b.toFloat(); }
	 else { center=Point(a,b); radius=r.toFloat(); }
      }
   }
   fcn copy{self(self)}
   fcn toString{"(%s,%d)".fmt(center.toString(),radius)}
}
   // see if various constructors work
Point(); Point(1); Point(1,2), Point(Point());
Circle(); Circle(1); Circle(1,2); Circle(1,2,3);
Circle(Point()); Circle(Point(),1);
Circle(Circle());
 
c:=Circle(1,2,3);
c.println(); c.center.println();
c.copy().println();