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
Two numbers to be subtracted using bitwise operations

Given a bool variable isReadable write some statements that assign true to isReadable if the file "topsecret" exists and can be read by the program and assigns false to isR


Control Flow The control flow statements are used when it is needed that the flow of the program is to be changed after taking some decision. This control flow statement theref

A: Mostly can be overloaded. The only C operators which can't be are. and?: (and sizeof, that is technically an operator). C++ adds a few of its own operators, mostly which can be

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 ''}''



processing two jobs through 2 machine

Write a program to input two integers. If they are equal display "The numbers are equal". Otherwise display a message if the first is a multiple of the second or if it is not a mul