SlideShare a Scribd company logo
1 of 37
Presentation Group Members :-
08. Ankita
14. Ashutosh
18. Samiksha
19. Laxman
S.Y.BSc.(Computer Science)
I
Types of Inheritance :-
Demo !!!!
Doubt & Question Session ????
Single
Inheritance
Multilevel
Inheritance
Multiple
Inheritance
Hierarchal
Inheritance
Hybrid
Inheritance
class base_class_name
{
access specifier:
:
};
Class derived_class_name : access specifier base_class_name
{
access specifier:
:
};
void A :: getdata ()
{
cout<<"nn Enter value
a:";
cin>>a;
cout<<"Enter value b:";
cin>>b;
}
void B :: calculate ()
{
c = (a + b);
}
void B :: display ()
{
cout<<"n"<<a<<"+"<<b<
<"="<<c;
}
Access Public Protected Private
Same class/
Base class
yes yes yes
Derived
classes
yes yes no
Outside
classes
yes no no
Public inheritance
Base access specifier
Derived access
specifier
Derived class access? Public access?
Public Public Yes Yes
Private Private No No
Protected Protected Yes No
Private inheritance
Base access specifier
Derived access
specifier
Derived class access? Public access?
Public Private Yes No
Private Private No No
Protected Private Yes No
Protected inheritance
Base access specifier
Derived access
specifier
Derived class access? Public access?
Public Protected Yes No
Private Private No No
Protected Protected Yes No
class derived class_name:<access_specifier>
class1_name,<access_specifier>
class2_name,………………………………………..,
<access_specifier> classn_name
{
:
: //members of derived class
:
}
SYNTAX:
class sub : public superA, private
superB
{
:
: //members of class sub
:
}
FOR INSTANCE:
Multilevel Inheritance :-
Definition:
“It is the inheritance hierarchy wherein subclass acts as a
base class for other classes”
It is implemented by defining at least three classes.
In multilevel inheritance, there is one base class and the
remaining two is derived class.
Declaration :-
class A
{………..
……….}; // Base class
class B : public A
{………..
……….}; // B derived from A
class C : public B
{……….
………}; // C derived from B
Fig. Multilevel Inheritance :-
Student
Test
Records
Result
Base Class
Intermediate
base class
Hybrid inheritance :-
Definition:
“Inheritance hierarchy that reflects any legal combination of
other four types of inheritance.”
Simple word:-
“The method of combining any two or more forms of
inheritance in single form is called hybrid inheritance.”
Fig. Hybrid Inheritance :-
Student
Test
Records
Result
Sports
Base
class
Intermediate
base class
Derived
class
Base
class
class A
{……….
………};
class B:public A
{……….
……….};
class C
{……….
………};
class D: public b, public c
{……….
……….};
Constructors in Inheritance :-
• Base class constructors are automatically called for you if
they have no argument.
• If you want to call a superclass constructor with an argument,
you must use the subclass's constructor initialization list.
• C++ supports multiple inheritance (for better or worse), so the
base class must be referred to by name, rather than "super()".
Constructor Example :-
class SuperClass
{
public:
SuperClass(int foo)
{ // do something with foo }
};
class SubClass : public SuperClass
{
public: SubClass(int foo, int bar) : SuperClass(foo)
{ // do something with bar }
};
Virtual keyword determines if a member function of a class can
be over-ridden in its derived classes.
The non-virtual member functions are resolved at compiling
time and it’s called static binding. However, the c++ virtual
member functions are resolved during runtime and it’s called
as dynamic binding
Virtual Class :-
For your Attention !!!!

More Related Content

What's hot

What's hot (20)

Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
 
Friends function and_classes
Friends function and_classesFriends function and_classes
Friends function and_classes
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract class
 
Inheritance in Object Oriented Programming
Inheritance in Object Oriented ProgrammingInheritance in Object Oriented Programming
Inheritance in Object Oriented Programming
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Constructors and Destructor in C++
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
INLINE FUNCTION IN C++
INLINE FUNCTION IN C++INLINE FUNCTION IN C++
INLINE FUNCTION IN C++
 
Virtual base class
Virtual base classVirtual base class
Virtual base class
 
07. Virtual Functions
07. Virtual Functions07. Virtual Functions
07. Virtual Functions
 
Inheritance in oops
Inheritance in oopsInheritance in oops
Inheritance in oops
 
Abstract Base Class and Polymorphism in C++
Abstract Base Class and Polymorphism in C++Abstract Base Class and Polymorphism in C++
Abstract Base Class and Polymorphism in C++
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Java - Generic programming
Java - Generic programmingJava - Generic programming
Java - Generic programming
 
Function overloading ppt
Function overloading pptFunction overloading ppt
Function overloading ppt
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
 

Viewers also liked

Viewers also liked (20)

inheritance c++
inheritance c++inheritance c++
inheritance c++
 
Inheritance
InheritanceInheritance
Inheritance
 
C++ Inheritance
C++ InheritanceC++ Inheritance
C++ Inheritance
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
Java inheritance
Java inheritanceJava inheritance
Java inheritance
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Java Inheritance
Java InheritanceJava Inheritance
Java Inheritance
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
Inheritance
InheritanceInheritance
Inheritance
 
Java: Inheritance
Java: InheritanceJava: Inheritance
Java: Inheritance
 
C++ Multiple Inheritance
C++ Multiple InheritanceC++ Multiple Inheritance
C++ Multiple Inheritance
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Inheritance
InheritanceInheritance
Inheritance
 
file handling c++
file handling c++file handling c++
file handling c++
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
pointers,virtual functions and polymorphism
pointers,virtual functions and polymorphismpointers,virtual functions and polymorphism
pointers,virtual functions and polymorphism
 
Programming in c++
Programming in c++Programming in c++
Programming in c++
 
Inheritance Presentation
Inheritance PresentationInheritance Presentation
Inheritance Presentation
 

Similar to Presentation Group Members and Types of Inheritance

12 constructors invocation and data members initialization
12 constructors invocation and data members initialization12 constructors invocation and data members initialization
12 constructors invocation and data members initializationDocent Education
 
12 constructors invocation and data members initialization
12 constructors invocation and data members initialization12 constructors invocation and data members initialization
12 constructors invocation and data members initializationDocent Education
 
INHERITANCE, POINTERS, VIRTUAL FUNCTIONS, POLYMORPHISM.pptx
INHERITANCE, POINTERS, VIRTUAL FUNCTIONS, POLYMORPHISM.pptxINHERITANCE, POINTERS, VIRTUAL FUNCTIONS, POLYMORPHISM.pptx
INHERITANCE, POINTERS, VIRTUAL FUNCTIONS, POLYMORPHISM.pptxDeepasCSE
 
MODULE2_INHERITANCE_SESSION1.ppt computer
MODULE2_INHERITANCE_SESSION1.ppt computerMODULE2_INHERITANCE_SESSION1.ppt computer
MODULE2_INHERITANCE_SESSION1.ppt computerssuser6f3c8a
 
Inheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ optInheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ optdeepakskb2013
 
chapter-10-inheritance.pdf
chapter-10-inheritance.pdfchapter-10-inheritance.pdf
chapter-10-inheritance.pdfstudy material
 
week14 (1).ppt
week14 (1).pptweek14 (1).ppt
week14 (1).pptamal68766
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In JavaManish Sahu
 
Ritik (inheritance.cpp)
Ritik (inheritance.cpp)Ritik (inheritance.cpp)
Ritik (inheritance.cpp)RitikAhlawat1
 
Inheritance slides
Inheritance slidesInheritance slides
Inheritance slidesawaisch888
 

Similar to Presentation Group Members and Types of Inheritance (20)

12 constructors invocation and data members initialization
12 constructors invocation and data members initialization12 constructors invocation and data members initialization
12 constructors invocation and data members initialization
 
12 constructors invocation and data members initialization
12 constructors invocation and data members initialization12 constructors invocation and data members initialization
12 constructors invocation and data members initialization
 
Inheritance and Interfaces
Inheritance and InterfacesInheritance and Interfaces
Inheritance and Interfaces
 
INHERITANCE, POINTERS, VIRTUAL FUNCTIONS, POLYMORPHISM.pptx
INHERITANCE, POINTERS, VIRTUAL FUNCTIONS, POLYMORPHISM.pptxINHERITANCE, POINTERS, VIRTUAL FUNCTIONS, POLYMORPHISM.pptx
INHERITANCE, POINTERS, VIRTUAL FUNCTIONS, POLYMORPHISM.pptx
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance
InheritanceInheritance
Inheritance
 
MODULE2_INHERITANCE_SESSION1.ppt computer
MODULE2_INHERITANCE_SESSION1.ppt computerMODULE2_INHERITANCE_SESSION1.ppt computer
MODULE2_INHERITANCE_SESSION1.ppt computer
 
Inheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ optInheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ opt
 
c++Inheritance.pdf
c++Inheritance.pdfc++Inheritance.pdf
c++Inheritance.pdf
 
Inheritance
InheritanceInheritance
Inheritance
 
chapter-10-inheritance.pdf
chapter-10-inheritance.pdfchapter-10-inheritance.pdf
chapter-10-inheritance.pdf
 
Inheritance
InheritanceInheritance
Inheritance
 
week14 (1).ppt
week14 (1).pptweek14 (1).ppt
week14 (1).ppt
 
Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
Ritik (inheritance.cpp)
Ritik (inheritance.cpp)Ritik (inheritance.cpp)
Ritik (inheritance.cpp)
 
Learn Java Part 11
Learn Java Part 11Learn Java Part 11
Learn Java Part 11
 
Learn Java Part 11
Learn Java Part 11Learn Java Part 11
Learn Java Part 11
 
201801 CSE240 Lecture 14
201801 CSE240 Lecture 14201801 CSE240 Lecture 14
201801 CSE240 Lecture 14
 
Inheritance slides
Inheritance slidesInheritance slides
Inheritance slides
 
OOP
OOPOOP
OOP
 

More from Laxman Puri

Remote access from a smartphone ppt
Remote access from a smartphone pptRemote access from a smartphone ppt
Remote access from a smartphone pptLaxman Puri
 
Co relation between dfd & event table
Co relation between dfd & event tableCo relation between dfd & event table
Co relation between dfd & event tableLaxman Puri
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming LanguageLaxman Puri
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machineLaxman Puri
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer GraphicsLaxman Puri
 

More from Laxman Puri (7)

Remote access from a smartphone ppt
Remote access from a smartphone pptRemote access from a smartphone ppt
Remote access from a smartphone ppt
 
Processors
ProcessorsProcessors
Processors
 
Dbms rlde.ppt
Dbms rlde.pptDbms rlde.ppt
Dbms rlde.ppt
 
Co relation between dfd & event table
Co relation between dfd & event tableCo relation between dfd & event table
Co relation between dfd & event table
 
Python Programming Language
Python Programming LanguagePython Programming Language
Python Programming Language
 
Java byte code & virtual machine
Java byte code & virtual machineJava byte code & virtual machine
Java byte code & virtual machine
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 

Recently uploaded

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 

Recently uploaded (20)

Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 

Presentation Group Members and Types of Inheritance