#include using namespace std; class Shape { public: virtual float getArea() = 0; // Pure virtual }; class Square : public Shape { private: int length; public: Square(int n) { length = n; } float getArea(); }; float Square::getArea() { return length * length; } class Rectangle : public Shape { private: int length; int width; public: Rectangle(int n, int m) { length = n; width = m; } float getArea(); }; float Rectangle::getArea() { return length * width; } void printArea(Shape& s) { cout << s.getArea() << endl; } int main() { // Shape bob; Square s(5); printArea(s); Rectangle r(5, 4); printArea(r); }