Multiple inheritance in c++

SujanMia2 2,928 views 10 slides Sep 11, 2017
Slide 1
Slide 1 of 10
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10

About This Presentation

This is ppt presentation of multiple inheritance .


Slide Content

Multiple Inheritance

Out lines of presentation What is inheritance? What is multiple inheritance? It’s application in our practical life. Example of multiple inheritace . Summary .

Inheritance: In object oriented programming , inheritance is when an object or class is based on another object or class ,using the same implementation. There are some types of inheritance given below: 1. single inheritance 2.multiple inheritance 3.multilevel inheritance 4.hierarchical inheritance 5.hybrid inheritance

Multiple inheritance: Multiple inheritance is a feature of c++ where a class can inherit from more than one classes. The constructors of inherited classes are called in the same order in which they are inherited. Here two or more base class and one derived class.

A simple program using multiple inheritance: #include< iostream > using namespace std; class info{ int id; public: void getid (){ cin >>id; cout <<id<< endl ;} }; class result{ int mark; public: void getmark (){ cin >>mark; cout <<mark<< endl ;} };

class student : private info,private result{ public: void display(){ getid (); getmark ();}}; int main(){ student ob; ob.display (); return 0;} Input: 154069 80 Output: 154069 80

Application and importancey of multiple inheritance: When the situation is to need one or more base class to get derived class then it’s applicable.

Summary: Finally I wanted to mean you that what is inheritance , classification,multiple inheritance,and its application and how it works.I belived that acknowlegement of this topics will be uses related sector in future.

Thank You