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
There are 3 acceptable answers: "Never," "Rarely "and" When the problem domain cannot be accurately modelled any other way."

Explain the Function Prototype? The Functions must be declared before they are used, ANSI C provides for the new function declaration syntax called as the function prototype,

Make the following 3 functions work by filling in appropriate C code. This file 1. // Write a function to count the number of particular characters in a string. // Do not use a


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

Define some Important Point for bit fields with structures? Only n lower bits will be assigned to an n bit number thus type cannot take values larger than 15 (4 bits long)

Define the Modulo Division Operator in c language? The C provides one more arithmetic operator % called as modulo division operator and this operator yields the remainder of an

flow chart for calculating the volume of sphere

Raj is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''{'' and end with ''}''

Explain about the Expressions in c Language? An expression is the combination of constants, variables and operators arranged as per the syntax of the language. Some of the illu