In this task, you will define the dynamic type of objects
Namely, there is a class hierarchy
class Shape {
public:
virtual double area() = 0;
};
class Ellipse : public Shape { // Oval
public:
double area() override;
};
class Circle : public Ellipse { // Circle
public:
double area() override;
};
class Rectangle : public Shape { // Rectangle
public:
double area() override;
};
class Square : public Rectangle { // Square
public:
double area() override;
};
Your task is to write functions
bool IsCircle(const Shape& shape);
bool IsEllipse(const Shape&shape);
bool IsSquare(const Shape&shape);
bool IsRectangle(const Shape& shape);
1. IsCircle returns true if the underlying shape object is a Circle. false --
otherwise
2. IsEllipse returns true if the underlying shape object is an Ellipse. false --
otherwise
3. IsSquare returns true if the underlying shape object is a Square. false --
otherwise
4. IsRectangle returns true if the underlying shape object is a Rectangle. false
-- otherwise
Namely, the call to IsRectangle(Square()) must return false, and only the call
IsRectangle(Rectangle()) will return true.
Send only the code of functions and the necessary libraries to the system, everything else will be
connected automatically
Hint: think about how you can use dynamic_cast