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




-- Point
local Point = {x = 0, y = 0}
 
function Point:new(o)
    o = o or {}
    setmetatable(o, self)
    self.__index = self
    return o
end
 
function Point:print()
    print("Point(" .. self.x .. ", " .. self.y .. ")")
end
 
function Point:copy()
    return Point:new{x = self.x, y = self.y}
end
 
-- Circle
local Circle = Point:new()
Circle.r = 0
 
function Circle:print()
    print("Circle(" .. self.x .. ", " .. self.y .. ", " .. self.r .. ")")
end
 
function Circle:copy()
    return Circle:new{x = self.x, y = self.y, r = self.r}
end