Polymorphism and Inheritance
Shape.h
class Shape {
           string color;
           bool filled;
public:
           Shape();
           Shape(string, bool);
           string getColor();
           bool isFilled();
           void setColor(string);
           void setFilled(bool);
           string toString();
//virtual string toString();
};
Rectangle.h
class Rectangle : public Shape {
           double length;
           double width;
public:
           Rectangle();
           Rectangle(double, double);
           Rectangle(double, double, string, bool);
           double getLength();
           double getWidth();
           void setLength(double);
           void setWidth(double);
           double getArea();
           double getPerimeter();
printShape() function prototypes:
void printShape(Shape); or
void printShape(Shape &);
^^test which works correctly
Make a Rectangle class and a Triangle class that extend Shapeclass
^^not sure how to do this
the main that has to be used
int main() {
Shape s;
Rectangle r(5,6, \"red\", true);
Triangle t(6, 10, \"blue\", true);
printShape(s);
Shape s1(\"blue\", false);
printShape(s1);
//add virtual and pass the object by reference
printShape(r);
printShape(t);
return 0;
}
the instances need to be created and printShape() method needsto be called
triangle formula used is =1/2base*height