Total members 11895 |It is currently Sat Dec 21, 2024 4:12 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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




Author:

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();
    }
};

 


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

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



Topic Tags

C++ OOP






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com