Switch to full style
For C/C++ coders discussions and solutions
Post a reply

Inheritance C++ Example

Thu Feb 23, 2012 4:03 pm

Inheritance C++ Example
How to base class call the function of drive class in c++?



Re: Inheritence

Thu Feb 23, 2012 4:43 pm

As you may knew , C++ don't have super reference like Java or C++ , so will have to use the class in case you are overriding a function . Here is a small example .
Code:
class ClassOne {
public:
    
void saveMyInfo();
};

class 
ClassTwo {
public:
    
void saveMyInfo();
};

class 
ClassThree : public ClassOne, public ClassTwo {
public:
    
void saveMyInfo()
    {
        
        
ClassOne::saveMyInfo();
        
ClassTwo::saveMyInfo();
    }
};

 


Post a reply
  Related Posts  to : Inheritance C++ Example
 Need Help about Inheritance     -  
 What is Inheritance?!!     -  
 help me! inheritance     -  
 Inheritance in c++     -  
 inheritance in c++     -  
 @AttributeOverride with Inheritance     -  
 Multiple Inheritance     -  
 Inheritance in java     -  
 single table inheritance     -  
 Inheritance & polymorphism checker code     -  

Topic Tags

C++ OOP