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
Write a program in C to implement a FTP client that can interoperate with a default FTP server . The client should implement basic FTP commands GET PUT LIST DELE . GET -> to

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

What is the use of default constructor? - It's a constructor that doesn't accept any parameters. - If there is no user-defined constructor for a class, compiler declares a d

Define Automatic storage classes - computer programming? The Variables declared within function bodies are automatic by default and automatic variables are declared inside a fu

Described multiple inheritance(virtual inheritance)? And explain its advantages and disadvantages? A: It is the procedure in which a child can be derived from more than one pare

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

Prepare a script for providing Instagram Followers/Likes I need to prepare a panel where my customer able to get Instagram followers or likes automatically. - A panel where I

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b


(a) Verify the values of the resistors with the following colour coding: (i) red-red-orange-silver (ii) orange-orange-black-blue-green (b) What is the value of a resistor