class shape { public: virtual double area() const { return 0; } //virtual double area is default behavior protected: double x, y; };
class rectangle : public shape { public: double area() const { return (height * width); } private: double height, width; }; class circle : public shape { public: double area() const { return (PI * radius * radius);} private: double radius; };