THIS IS C++ PROBLEM FOR MY COMP SCI IICLASS
class Shape {
public:
void setDim(double, double = 0);
virtual void showArea();
protected:
double x, y;
};
setDim(double xx, double yy) {} //Write setDim here to setdimensions x and y
// Derived class Triangle from Shape
class Triangle : public Shape{
public:
virtual void showArea();
};
// Derived class Rectangle from Shape
class Rectangle : public Shape{
public:
virtual void showArea();
};
// Derived class Circle from Shape
class Circle : public Shape{
public:
virtual void showArea();
};
//Write driver and call object of each shape
int main(){}
Answer
#include <iostream>using namespace std;class Shape {public: void setDim(double, double = 0); virtual void showArea();protected: double x, y;};void Shape::setDim(double