.Your solution mustinclude header, implementation file, and test files.
InC++ write a code to Consider a graphics system that has classes forvarious figures rectangles, squares, triangles, circles, and so on.For example, a rectangle might have data members for Height, Widthand center point, while a square and circle might have only acenter point and an edge length or radius.
In a well-designed system, these would be derived from a commonclass, Figure.You are to implement such a system.
The class Figure is the base class. You should add onlyRectangle and Triangle classes derived from Figure.
Each class has two member functions erase
Each of the member functions erase and draw outputs a message telling what function has been called and whatthe class of the calling object is. For example if you call thefunction erase from the object of type Rectangle, the outputis “this isthe function Rectangle::erase()”.(These functions do nothing more than output this message.)
The base class has another extra function named center.The member function center will also output a message likethis: “themember function center is called to erase anddraw”.Then it will calls the erase and draw functions to erase and drawthe figure. So basically this function just write a line in theoutput and then it will call erase and draw functions.
All the member functions should take no arguments.
There are three parts to this project:
Write the class definitions using no virtual functions. Compile andtest. Make the base class member functions virtual. Compile and test.
Explain the difference in results .
Use the following main function for all testing(Rememberto include necessary files before main):
cout << “n In main, Derived class Triangle objectcalling”
<<” center().n”; tri.center();
cout << “n In main, Derived class Rectangle objectcalling”
<<” center().n”; rect.center();