#include <iostream.h> class shape { private: double x, y; // Position public: void setposition(double x, double y); void printarea(); virtual double area(); }; double shape::area() { return (0); } void shape::printarea() { cout << area() << "\n"; } void shape::setposition(double x, double y) { shape::x = x; shape::y = y; } class circle : public shape { private: double radius; public: void setradius(double r); virtual double area(); }; void circle::setradius(double r) { radius = r; } double circle::area() { return (3.1415927 * radius * radius); } class rectangle : public shape { private: double height, width; public: void setdimensions(double h, double w); virtual double area(); }; void rectangle::setdimensions(double h, double w) { height = h; width = w; } double rectangle::area() { return (height * width); } main() { circle c; rectangle r; shape *sp; r.setposition(1, 2); c.setposition(3, 4); r.setdimensions(10, 10); c.setradius(1); c.printarea(); r.printarea(); sp = &r; cout << sp->area(); }