0% found this document useful (0 votes)
24 views3 pages

CPP Inheritance Report

The document provides an overview of inheritance in C++, a key concept in Object-Oriented Programming that allows derived classes to acquire properties and methods from base classes. It describes various types of inheritance including single, multiple, multilevel, hierarchical, and hybrid inheritance, along with examples for each type. The conclusion emphasizes the importance of inheritance for code reuse and the design of scalable object-oriented systems.

Uploaded by

viceso5578
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

CPP Inheritance Report

The document provides an overview of inheritance in C++, a key concept in Object-Oriented Programming that allows derived classes to acquire properties and methods from base classes. It describes various types of inheritance including single, multiple, multilevel, hierarchical, and hybrid inheritance, along with examples for each type. The conclusion emphasizes the importance of inheritance for code reuse and the design of scalable object-oriented systems.

Uploaded by

viceso5578
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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

You might also like