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 (protected x=0.0, protected y=0.0) {
    public function print {
        println ("Point")
    }
 
    public function getX { return x }
    public function getY { return y }
 
    public function setX(nx) { x = nx }
    public function setY(ny) { y = ny }
}
 
class Circle (x=0.0, y=0.0, r=0.0) extends Point (x, y) {
    public function print {
        println ("Circle")
    }
 
    public function getR { return r }
    public function setR(nr) { r = nr }
}
 
var p = new Point (1, 2)
var c = new Circle (1, 2, 3)
p.print()
c.print()
 
 