This document was uploaded by user and they confirmed that they have the permission to share
it. If you are author or own the copyright of this book, please report to us by using this DMCA
report form. Report DMCA
Overview
Download & View Inheritance Programs as PDF for free.
/* When a base class and a derived class define a function of same name the derived class function supersedes the base class definition. the base class function will be called only if the derived class does not redefine the function*/ 4. Single Inheritance Same member function in base class derived class class base { int a; public: int b; void getdata(void); void putdata(void); int get_value(void); void put_value(void); }; class derived:public base //Public derivation { int c; public: void sum(void); void putdata(void);// same function name }; void base::getdata(void) { cout<<"Enter a and b"; cin rel="nofollow">>a>>b; } void base::putdata(void) { cout<<"base a="<>a>>b>>c; } void base::putdata(void) { cout<<"a="<>a>>b>>c; } void base::putdata(void) { cout<<"a="<>a>>b>>c; } void base::putdata(void) { cout<<"a="<>a>>b>>c; } void base::putdata(void) { cout<<"a="<
8