The purpose of this exercise is to get some experience with programming of classes in a pure specialization hierarchy.
I have programmed the class Polygon. The well-known class Point, which we have seen several times during the course, is used as a building block of class Polygon type. (Notice that class Point has a MidPoint operation and a RotateAroundPoint operation).
The class Polygon has the following public operations:
Now program the following specializations of Polygon:
For the sake of simplicity you are allowed (but not forced) to assume that the edges of the square are parallel with the x-axis and the y-axis.
Please refer to the Polygon type hierarchy on the accompanying slide.
Quadrangle and Square should support the same operations as Polygon. In particular Quadrangle and Square should support adequate constructors of their own.
It is not necessary to use four points for representation of a square. Discuss this problem and try to find a solution.