Explain multiple inheritance, C/C++ Programming

Multiple Inheritance

Multiple inheritance , as the name suggests , is  deriving a class from more than one class . The derived class inherits all the properties of all its base classes. Consider the following example


class Aclass
 {
    :
    :
 };

class  Bclass
 {
    :
    :
 };

class Cclass : public Aclass , public Bclass
 {

  private :
            :
            :
  public  :

        Cclass(...) : Aclass (...), Bclass(...)
         {
         };
 };


 The class Cclass in the above example is derived from two classes - Aclass and Bclass - thus the first line of its class definition have the name of two classes, both publicly inherited. Like with normal inheritance , constructors have to be explained for initializing the data members of all classes. The constructor in Cclass  calls constructors for base classes. The constructor calls are separated by commas.

Posted Date: 6/28/2013 5:40:18 AM | Location : United States







Related Discussions:- Explain multiple inheritance, Assignment Help, Ask Question on Explain multiple inheritance, Get Answer, Expert's Help, Explain multiple inheritance Discussions

Write discussion on Explain multiple inheritance
Your posts are moderated
Related Questions
c++ program to to implement multiple stacks using single array



Explain each of the algorithms in a way that would be understandable to an intelligent person who is not familiar with programming. You should not use any code (or even pseudo code

A palindrome is a string that reads the same from the both the ends. Given a string S convert it to a palindrome by doing character replacement. Your takes is to convert S to palin

how to make a game

#include stdio.h> #include conio.h> #include ctype.h> #include string.h>   void main() {           int i=0,j=0,length;           char a[30];           cl

Writing and compiling a program from a given Use Case definition. Follow the Average Temperature in Paradise

basic salary of employees & calculate net salary in C++ Programming

Deliverables: you are required to upload your c code in the assignment dropbox set in Moodle. You are supposed to work with Linux gcc compiler and pico editor for compiling via the