Computer Engineering object-oriented programming using c++
Maharashtra State Board of Technical Education,
Mumbai
MIT POLYTECHNIC
ROTEGAON.
2024-2025
A PROJECT REPORT ON
Project Name: “MULTIPLE INHERITANCE AND MULTILEVEL
INHERITANCE PROGRAM WITH OUTPUT”
SUBMITED BY:
1) KHAIRNAR KALYANI DINANATH (09)
2) CHANDWADE UTKARSHA BHIMSING (10)
3) AHER GITA GORAKH (64)
UNDER THE GUIDANCE OF:
Mrs.M.B.Jadhav
Page 1 of 16
Computer Engineering object-oriented programming using c++
CERTIFICATE:
This is to certify that:
§ Roll No: 09
§ Roll No: 10
§ Roll No: 64
Diploma in Computer Engineering, has satisfactorily completed the project
work under mini project report on, Project Name: “MULTIPLE
INHERITANCE AND MULTILEVEL INHERITANCE PROGRAM
WITH OUTPUT” under my guidance and supervision, this is part of partial
fulfilment of the requirement for submission of Maharashtra State Board
of Technical Education, Mumbai during Semester third of Academic year
2024-2025.
GUIDE HOD PRINCIPAL
Mrs.M.B.Jadhav. Mr.S.Ram. Mr.K.S.Patil
Computer Dept. Computer Dept. MIT Polytechnic,
Rotegaon
TABLE OF CONTENTS
Page 2 of 16
Computer Engineering object-oriented programming using c++
SR .NO INDEX PAGE NO
1 Aim of the Microproject 4
2 Introduction 5
3 Concepts 6
4 Program 7
5 Program output 10,12
6 Conclusion 14
7 Acknowledgement 15
8 Reference 16
Aim of the Microproject
Object-oriented programming System (OOPs) is a programming
paradigm based on the concept of “objects” that contain data and
methods. The primary purpose of object-oriented programming is to
increase the flexibility and maintainability of programs. Object
oriented programming brings together data and its
Page 3 of 16
Computer Engineering object-oriented programming using c++
behavior(methods) in a single location(object) makes it easier to
understand how a program works. We will cover each and every
feature of OOPs in detail so that you won’t face any difficulty
understanding OOPs Concepts.
Page 4 of 16
COMPUTER ENGINEERING object-oriented programming using c++
Introduction
Multiple Inheritance
Inheritance is an object-oriented property concept where a class can
access the properties and methods of the other class. The class which
attains the qualities of the other class is called the derived/child class.
The class which gives the right to giving its properties to other
classes is called base/parent class.
In the concept of Multiple Inheritance, there are multiple base classes
and a child class. The derived class can attain its qualities from all
the base classes. Let us move further in understanding the concept of
Multiple Inheritance in C++ programming language.
Multilevel Inheritance
Inheritance is a property wherein an object of one class possesses
the properties of another class and can further inherit the properties
to other classes. Such type of parent-child relationship between class
frames to be an inheritance. Multilevel is a kind of inheritance
where a base or child class has more than one parent classes and it
can be extended to any level. Therefore, like other inheritance
features like hierarchical inheritance and multiple inheritances, we
can conclude that those base classes who have more than one parent
class been called Multilevel inheritance in C++.
Page 5 of 17
COMPUTER ENGINEERING object-oriented programming using c++
Concepts
1.Multiple Inheritance
In Multiple inheritance, a single derived class can inherit property
from more than one base class. For example, as explained below,
class Derived inherits property from both Class Base1 and Class
Base2.
Syntax:
Page 6 of 17
COMPUTER ENGINEERING object-oriented programming using c++
class Derived: access_mode Base1, access_mode Base2
//body of Derived class which inherit property from more
onethan
base class that is Base1 & Base2
};
Multiple Inheritance Algorithm
• Step 1: Start the program.
• Step 2: Declare the base class student.
• Step 3: Declare and define the function get () to get the student
details.
• Step 4: Declare the other class sports.
• Step 5: Declare and define the function getsm () to read the sports
mark.
• Step 6: Create the class statement derived from student and sports.
• Step 7: Declare and define the function display () to find out the
total and average.
Page 7 of 17
COMPUTER ENGINEERING object-oriented programming using c++
• Step 8: Declare the derived class object, call the functions get (),
getsm () and display ().
• Step 9: Stop the program.
2. Multilevel Inheritance
In multilevel inheritance, the derived class inherits property from another derived
class. For example, as explained below, class Derived1 inherits property from class
Base and class Derived2 inherits property from class Derived1.
Syntax:
Page 8 of 17
COMPUTER ENGINEERING object-oriented programming using c++
// body of Derived1 class which inherit property from base
class
};
Cl ass Derived2: access_mode Derived1
// body of Derived2 class which inherit property from Derived1
class
};
Page 9 of 17
COMPUTER ENGINEERING object-oriented programming using c++
Program
Multiple Inheritance Program
Page 10 of 17
COMPUTER ENGINEERING object-oriented programming using c++
{
int result;
result= a+b+c+d+e+f+g;
cout<<" Sum of all the values is: "<<result<< endl;
}
};
int main()
{
Value_4 v;
v.sum();
}
OUTPUT
Page 11 of 17
COMPUTER ENGINEERING object-oriented programming using c++
Program
Multilevel Inheritance
Page 12 of 17
COMPUTER ENGINEERING object-oriented programming using c++
{
R r;
r.display();
r.display1();
return 0;
}
Output:
Page 13 of 17
COMPUTER ENGINEERING object-oriented programming using c++
Conclusion
Multiple inheritance
Here, we have seen the concept of multiple inheritance which can take place
through the concept of variables and methods using the C++ programming
language. We even displayed the error output in case of accessing the property
of the base class without being inherited by the derived class. Keep practicing
with different access modifies (public, private and protected) and understand
the workflow for the same.
Multi-level inheritance
Unlike other inheritance multi-level inheritance has a special feature that it
can be extended to any level of inheritance besides a condition that it depends
on the requirements of the object and the class. Also, a base class can have
more than one parent class. This situation can even arise in the real world
which can be overcome using multi-level inheritance.
Page 14 of 17
COMPUTER ENGINEERING object-oriented programming using c++
Acknowledgement:
We take this opportunity to express sincere thanks to our project guide.
Ms. Lavangare.V.M Under whose guidance our project is done.
We also thanks to all the Computer department teachers for their
valuable guidance, and timely suggestions without which we
could not complete this project work.
Only because of our staff inspiration and instructions we
could achieve satisfactory completion of project work.
Last but not least, we wish to thanks all of those who have helped us
Page 15 of 17
Computer Engineering object-oriented programming using c++
Reference
➢ Internet link used as reference:
Multiple Inheritance in C++ | How Multiple Inheritance Works in C++? (educba.com)
Page 16 of 16