Report on 8085 Microprocessor
1. Introduction
Inheritance is a fundamental concept in Object-Oriented Programming (OOP) in C++. It allows a class
(derived class) to acquire properties and behaviors (methods) from another class (base class). Inheritance
promotes code reusability and establishes a relationship between classes.
2. Types of Inheritance
C++ supports several types of inheritance:
1. Single Inheritance
2. Multiple Inheritance
3. Multilevel Inheritance
4. Hierarchical Inheritance
5. Hybrid Inheritance
3. Single Inheritance
In single inheritance, a derived class inherits from only one base class.
Example:
class Base {
public:
void show() { cout << "Base class"; }
};
class Derived : public Base {
};
Page 1
Report on 8085 Microprocessor
4. Multiple Inheritance
In multiple inheritance, a derived class inherits from more than one base class.
Example:
class A {
public:
void displayA() { cout << "Class A"; }
};
class B {
public:
void displayB() { cout << "Class B"; }
};
class C : public A, public B {
};
5. Multilevel Inheritance
In multilevel inheritance, a class is derived from another derived class.
Example:
class A {
public:
void showA() { cout << "Class A"; }
};
class B : public A {
public:
Page 2
Report on 8085 Microprocessor
void showB() { cout << "Class B"; }
};
class C : public B {
public:
void showC() { cout << "Class C"; }
};
6. Hierarchical and Hybrid Inheritance
Hierarchical Inheritance:
Multiple classes inherit from a single base class.
Hybrid Inheritance:
A combination of more than one type of inheritance. It often involves a mix of hierarchical and multiple
inheritance and may require virtual inheritance to resolve ambiguities.
7. Conclusion
Inheritance in C++ is a powerful feature that facilitates code reuse and supports the implementation of
polymorphism. Understanding the various types of inheritance helps in designing robust and scalable
object-oriented systems.
Page 3