SlideShare a Scribd company logo
INFORMATION TECHNOLOGY
Object oriented programming with c++(2140705)
Inheritance
TA4
Name & Enrollment no:
Ashutosh Makwana - 141130116003
Meet Gandhi – 141130116014
Divyesh Mangroliya – 141130116033
Kishan Modiya – 141130116038
Jay Patel - 141130116055
What is Inheritance
• Inheritance is one of the important
feature of the OOP.
• Inheritance is the method by which
objects of one class gets the properties
of another class.
Advantages of Inheritance
Sometimes we need to repeat the code or we need
repeat the whole class properties. So It helps in
various ways.
1.) It saves memory space.
2.) It saves time.
3.) It will remove frustration.
4.) It increases reliability of the code
5.) It saves the developing and testing efforts.
Why we use Inheritance?
To increase the reusability of the code
and to make further usable for another
classes we use the concept of
inheritance.
How Inheritance can be achieved?
• In the inheritance there will be a parent child
relationship .
• There is a class called in which all the
properties are defined and generally, it is
referred as a base class.
• There is also an another class in which is
derived from the existing one are known as a
derived class.
How to define derived class?
A derived class can be defined by specifying its relationship with the base class in
addition to its own details.
syntax:
Class derived-class-name: visibility-mode base-class-name
{
member of derived class
};
Visibility mode
1.Public
2.Private
3.Protected
Types of Inheritance
1.) Single Inheritance
2.) Multilevel Inheritance
3.) Hierarchical Inheritance
4.) Multiple Inheritance
5.) Hybrid inheritance
Single inheritance
• Each class or instance object has a single parent
A
B
Multiple inheritance
Classes inherit from multiple base classes.
A B
C
Multilevel inheritance
Class is derived from another derived class
A
B
C
Hierarchical inheritance
A
B C D
Hybrid inheritance
In this type two or more types of inheritance are used to design a program.
A
B
C
D
Example:
#include<iostream.h>
#include<conio.h>
Class student
{
protected:
in roll_number;
public:
void get_number(int a)
{
roll_number=a;
}
void put_number(void)
{
cout<<“roll no:”<<roll_number<<“n”;
}
};
Class test : public student
{
protected;
float part1,part2;
public:
void get_marks(float x, float y)
{
part1=x; part2=y;
}
void put_marks(void)
{
cout<<“marks obtained:”<<“n”
<<“part1=“<<part1<<“n”
<<“part2=“<<part2<<“n”;
}
};
Class sports
{
protected:
float score;
public:
void get_score(float s)
{
score=s;
}
void put_score(void)
{
cout<<“sports wt:”<<score<<“nn”;
}
};
Class result: public test , public sports
{
Float total;
Public:
void display(void);
};
Void result:: display (void)
{
total=part1+part2+score;
put_number();
put_marks();
put_score();
cout<<“total score:”<<total<<“n”;
};
int main()
{
result student_1;
student_1.get_number(1234);
student_1.get_marks(27.5,33.0);
student_1.get_score(6.0);
student_1.display();
return 0;
}
Output:
Roll no: 1234
Marks obtained:
Part1=27.5
Part2=33
Sports wt:6
Total score:66.5
THANK YOU

More Related Content

PDF
Multiple Inheritance
PPTX
Inheritance
PPTX
Classes and Objects
PPT
polymorphism
PPTX
Inheritance in Java
PPTX
Multiple inheritance in c++
Multiple Inheritance
Inheritance
Classes and Objects
polymorphism
Inheritance in Java
Multiple inheritance in c++

What's hot (20)

PDF
Object oriented programming With C#
PPT
Inheritance : Extending Classes
PPTX
Encapsulation
PPTX
Introduction to Object Oriented Programming
PPTX
Inheritance in c++ part1
PDF
Java programming -Object-Oriented Thinking- Inheritance
PPTX
Characteristics of OOPS
PPTX
Object oriented programming Fundamental Concepts
DOC
How would you implement multiple inheritance in java
PPTX
Characteristics of oop
PDF
C++ [ principles of object oriented programming ]
PPTX
Principles and advantages of oop ppt
PDF
Oops (inheritance&interface)
PPTX
Single inheritance
PPTX
Concept of OOPS with real life examples
PPT
Lecture 2
PDF
Object-oriented Programming-with C#
PPTX
[OOP - Lec 07] Access Specifiers
Object oriented programming With C#
Inheritance : Extending Classes
Encapsulation
Introduction to Object Oriented Programming
Inheritance in c++ part1
Java programming -Object-Oriented Thinking- Inheritance
Characteristics of OOPS
Object oriented programming Fundamental Concepts
How would you implement multiple inheritance in java
Characteristics of oop
C++ [ principles of object oriented programming ]
Principles and advantages of oop ppt
Oops (inheritance&interface)
Single inheritance
Concept of OOPS with real life examples
Lecture 2
Object-oriented Programming-with C#
[OOP - Lec 07] Access Specifiers
Ad

Viewers also liked (12)

PPTX
General oops concepts
PPT
Introduction to oop
PPT
OOP programming
PPT
General OOP concept [by-Digvijay]
PPTX
Object Orinted Programing(OOP) concepts \
PPT
Object-Oriented Programming Concepts
PPT
Chapter 8 Covalent Bonds
PPTX
Object Oriented Concept
PPT
Basic concepts of object oriented programming
PPTX
Introduction to Object Oriented Programming
PPT
Oops ppt
PPT
Object Oriented Programming Concepts
General oops concepts
Introduction to oop
OOP programming
General OOP concept [by-Digvijay]
Object Orinted Programing(OOP) concepts \
Object-Oriented Programming Concepts
Chapter 8 Covalent Bonds
Object Oriented Concept
Basic concepts of object oriented programming
Introduction to Object Oriented Programming
Oops ppt
Object Oriented Programming Concepts
Ad

Similar to INHERITANCE-Oopc ppt-ta4 (20)

PPTX
Final presentation programming
PPT
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
PPT
Java_notes.ppt
PPTX
) Function overriding, Member Classes Nesting of Classes.pptx
PPTX
Concepts of oop1
PDF
OOP Assign No.03(AP).pdf
PPT
Overview of Object Oriented Programming using C++
PPTX
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
PPTX
Inheritance in java.pptx_20241025_101324_0000.pptx.pptx
PPTX
Java Inheritance
PDF
inheritance-16031525566nbhij56604452.pdf
PPTX
Inheritance in c++
PPTX
Inheritance in oops
PPTX
java part 1 computer science.pptx
PPTX
Inheritance
PPTX
oop.pptx
PPTX
Inheritance in OOPs with java
PPTX
29csharp
PPTX
PPTX
Inheritance
Final presentation programming
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Java_notes.ppt
) Function overriding, Member Classes Nesting of Classes.pptx
Concepts of oop1
OOP Assign No.03(AP).pdf
Overview of Object Oriented Programming using C++
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
Inheritance in java.pptx_20241025_101324_0000.pptx.pptx
Java Inheritance
inheritance-16031525566nbhij56604452.pdf
Inheritance in c++
Inheritance in oops
java part 1 computer science.pptx
Inheritance
oop.pptx
Inheritance in OOPs with java
29csharp
Inheritance

Recently uploaded (20)

PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
B.Tech (Electrical Engineering ) 2024 syllabus.pdf
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
MET 305 MODULE 1 KTU 2019 SCHEME 25.pptx
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
PPTX
TE-AI-Unit VI notes using planning model
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
Introduction to Data Science: data science process
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Queuing formulas to evaluate throughputs and servers
PPTX
AgentX UiPath Community Webinar series - Delhi
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
International Journal of Information Technology Convergence and Services (IJI...
PPTX
The-Looming-Shadow-How-AI-Poses-Dangers-to-Humanity.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
B.Tech (Electrical Engineering ) 2024 syllabus.pdf
Operating System & Kernel Study Guide-1 - converted.pdf
Strings in CPP - Strings in C++ are sequences of characters used to store and...
MET 305 MODULE 1 KTU 2019 SCHEME 25.pptx
July 2025: Top 10 Read Articles Advanced Information Technology
TE-AI-Unit VI notes using planning model
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
bas. eng. economics group 4 presentation 1.pptx
Introduction to Data Science: data science process
CH1 Production IntroductoryConcepts.pptx
Queuing formulas to evaluate throughputs and servers
AgentX UiPath Community Webinar series - Delhi
Arduino robotics embedded978-1-4302-3184-4.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
International Journal of Information Technology Convergence and Services (IJI...
The-Looming-Shadow-How-AI-Poses-Dangers-to-Humanity.pptx

INHERITANCE-Oopc ppt-ta4