Write a program to implement the following single inheritance of classes with private visibility mode.
Class parent is a class Point that contains the private section with members:
•
coordinates of point (2D, float)
and public section with members:
•
constructor
•
destructor
•
access functions
•
function distance(float x, float y) that returns distance between coordinates x and y that pass to function and object of class
•
function coorx(float d) that returns coordinate x of point that is placed on distance d from the object of class but the coordinate y of this point has the same value as object of class
•
function coory(float d) that returns coordinate y of point that is placed on distance d from the object of class but the coordinate x of this point has the same value as object of class
•
function print() that prints the values of private members.
Class child is class Square that contains the private section with members:
•
length of diagonal (float)
and public section with members:
•
constructor
•
destructor
•
access function
•
function coordinates(float x, float y) that returns the coordinates of all vertices and coordinates of intersection of diagonals of object of class if the one vertex has coordinates x and y that passes to function (sides of object of class in parallel to axis of system coordinates)
•
function side() that returns length of sides of object of class
•
function distance(Square) that returns distance between intersections of diagonals of square that passes to function and object of class
•
function print() that prints the length of side and coordinates of all vertices of object of class
Test class Square in main program.