0% found this document useful (0 votes)
43 views14 pages

Inheritance in C++: Dr. Munesh Singh

This document discusses inheritance in C++. It begins by explaining the need for inheritance using an example of a car class and subclasses for specific types of cars. It then defines inheritance as the process of inheriting properties and behavior from an existing or parent class into a new or child class. The document outlines the syntax for inheritance in C++ and provides examples of different types of inheritance including single, multilevel, multiple, hierarchical, and hybrid inheritance. It also discusses visibility modes for inherited members as private, protected, or public and provides an example to illustrate inheritance.

Uploaded by

MUNESH SINGH
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)
43 views14 pages

Inheritance in C++: Dr. Munesh Singh

This document discusses inheritance in C++. It begins by explaining the need for inheritance using an example of a car class and subclasses for specific types of cars. It then defines inheritance as the process of inheriting properties and behavior from an existing or parent class into a new or child class. The document outlines the syntax for inheritance in C++ and provides examples of different types of inheritance including single, multilevel, multiple, hierarchical, and hybrid inheritance. It also discusses visibility modes for inherited members as private, protected, or public and provides an example to illustrate inheritance.

Uploaded by

MUNESH SINGH
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/ 14

Inheritance in

C++

Dr. Munesh
Singh
Inheritance in C++

Dr. Munesh Singh

Indian Institute of Information Technology


Design and Manufacturing,
Kancheepuram
Chennai-600127

January 19, 2019


Understand the need of Inheritance

Inheritance in
C++

Dr. Munesh
Singh

Class is used to describe properties and behavior of an


object.
Property names and values
Behavior means actions
Let us assume that we want to represent a car.
Car

Inheritance in
C++

Dr. Munesh
Singh
Sport Car

Inheritance in
C++

Dr. Munesh
Singh
Inheritance

Inheritance in
C++

Dr. Munesh
Singh

It is a process of inheriting properties and behavior of


exising class into a new class.
Existing class=old class=Parent class=Base class
New class= Child class=Derived Class
Syntax

Inheritance in
C++

Dr. Munesh
Singh
Example

Inheritance in
C++

Dr. Munesh
Singh
Types of Inheritance

Inheritance in
C++

Dr. Munesh
Singh

Single Inheritance
Multilevel Inheritance.
Multiple Inheritance
Hierarchical Inheritance
Hybrid Inheritance
Single Inheritance

Inheritance in
C++

Dr. Munesh
Singh
Multilevel Inheritance

Inheritance in
C++

Dr. Munesh
Singh
Multiple Inheritance

Inheritance in
C++

Dr. Munesh
Singh
Hierarchical Inheritance

Inheritance in
C++

Dr. Munesh
Singh
Visibility Modes

Inheritance in
C++ Private
Dr. Munesh
Singh Protected
Public
Types of users of a class
User 1 will create Object of your class
User 2 will derived class from your class
Availability vs Accessibility
Example of Inheritance

Inheritance in
C++

Dr. Munesh
Singh

You might also like