
Shape
Square
Circle
Rectangle
class Shape { string name;
public:
Shape(string); virtual void ToString(); virtual void Area()=0;
};
class Square : public Shape { double side; public: Square(string,double); virtual void setside(double); virtual double Area(); virtual void ToString(); };
class Circle : public Shape { double diameter; public: Circle(string,double); virtual void setdiam(double); virtual double Area(); virtual void ToString(); };
class Rectangle : public Square { double width; public: Rectangle(string,double,double); void setheight(double); void setwidth(double); virtual double Area(); virtual void ToString(); };
Question A1 Write the implementation codes for Shape class based on the description provided.
Shape class: Shape(string)- the argument refers to name. void ToString()- displays the name of the shape.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.