Code:
class Parent{ public: virtual int width(); virtual int height(); int area(){return width()*height();}; //[B]Virtual functions are used here to define another function, but this produces an error. [/B] //[B]Is is possible to do something like this? [/B] }; class Child: public Parent{ int w; int h; public: Child(int a,int b){w=a;h=b;}; int width(){return w;} int height(){return h;} };
Comment