Circle Square Triangle Based on the above hierarchy, please define classes as fo
ID: 3533701 • Letter: C
Question
Circle Square Triangle
Based on the above hierarchy, please define classes as following:
TwoDimensionalShape:
Member functions: pure virtual function for GetArea
Circle: Private data member: radius
Member function: constructor, GetArea
Square: Private data member: length
Member function: constructor, GetArea
Triangle: Private data members: base and height
Member function: constructor, GetArea
Each TwoDimensionalShape should cotain a virtual function GetArea to calculate the area of the shape. Use the following main function to test your classes.
int main()
{
Circle c(10);
Square s(10);
Triangle t(10,5);
c.GetArea(); // will display
Explanation / Answer
//yes, it is not hard. Here you go and please rate:
http://ideone.com/HhYxSy
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.