Create a base class named Point consisting of x and y data members representing point coordinates. From this class, derive a class named Circle with another data member named radius. For this derived class, the x and y data members represent a circle’s center coordinates. The member functions of the Point class should consist of a constructor, an area() function that returns 0, and a distance() function that returns the distance between two points,(x1,y1) and (x2,y2), where Additionally, the derived class should have a constructor and an override function named area() (PI*pow(radius,2)) that returns a circle’s area. Task: 1-Include the classes constructed in a working C++ program. 2-Have your program call all the member functions in each class. 3- In addition, call the base class’s distance() function with two circle objects and explain the results this function returns.
Create a base class named Point consisting of x and y data members representing point coordinates.
From this class, derive a class named Circle with another data member named radius. For this derived class, the x and y data members represent a circle’s center coordinates. The member functions of the Point class should consist of a constructor, an area() function that returns 0, and a distance() function that returns the distance between two points,(x1,y1) and (x2,y2), where
Additionally, the derived class should have a constructor and an override function named area() (PI*pow(radius,2)) that returns a circle’s area.
Task:
1-Include the classes constructed in a working C++ program.
2-Have your program call all the member functions in each class.
3- In addition, call the base class’s distance() function with two circle objects and explain the results this function returns.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps