Inheritance Exercises |
< Previous Next > |
#include <iostream> using std::cout; class Shape { private: double m_Area; public: Shape(): m_Area(0.0) { } Shape( double area) : m_Area( area) { } void setArea( double a){ m_Area = a; } double getArea(){ return m_Area; } }; int main(){ Circle cir; cir.setRadius(5.0); cir.print(); return 0; }
Last Modified: