Virtual Functions

Embed Size (px)

DESCRIPTION

C plus plus virtual functions

Citation preview

Consider the following program:#include #include #include using namespace std;class One{ protected: float a; public: One() ; // a constructor void f1(void); // a method void f2(void); // another method ... f2() will call f1() as part of its execution};One::One(){ a = 1.0;}void One::f1(void){ cout