SlideShare a Scribd company logo
1 of 17
Sharda University
Department Of Computer Science And Engineering
School Of Engineering And Technology
Greater Noida, U. P.
Presented By
Hirra Sultan
CSE-B 2nd year
Roll No. 120101091
Enrollment No. 2012017740
Supervisor: Mr. A. K. Sahoo
prlhirr@gmail.com
Introduction
Background
 The first OOP language designed for the
first personal computer was smalltalk.
 When OOP was integrated into C
language, the resulting language was
called C++ and it became the first object-
oriented language to be widely used
commercially.
 Later java and other OOP languages were
developed.
Concept of Inheritance
 Inheritance is that feature of an OOP language
which allows reusability of code of a class and
is considered corner stone of OOP languages.
 Using inheritance, we can create a general
class that defines traits common to a set of
related items.
 This class may then be inherited by other,
more specific classes, each adding only those
things that are unique to the inheriting class.
 Base class: The class which gets inherited is
called a base class. The code of this class is
passed on to subclasses where it is reused.
 Derived class: A subclass is a derived class
which inherits the base class and uses its
member functions.
 Un-inheritable class: A class may be
declared as un-inheritable by adding certain class
modifiers to the class declaration before the
"class" keyword and the class identifier
declaration. Such sealed classes
restrict reusability.
Definitions
Types of Inheritance
 Single Inheritance: In single
inheritance there is only one super class
and only one sub class.
 Multi-level inheritance: In multi-level
inheritance a derived class is inherited by
another class thus making multiple levels.
 Multiple Inheritance: A class can inherit
the attributes of two or more classes. This
is known as multiple inheritance.
 Hierarchical inheritance: When a base
class is inherited by multiple derived
classes it is called hierarchical inheritance.
 Hybrid inheritance: This is a mixture of
two or more inheritances in a single code.
Inheritance may be derived in three forms
which decides the way inherited data
members can be used.
 Public Inheritance: Public members of
the base class become public members of
the derived class and protected members
of the base class
become protected members of the derived
class.
 Protected Inheritance: When
deriving from a protected base class, public
and protected members of the base class
become protected members of the derived
class.
 Private Inheritance: When deriving
from a private base class, public and
protected members of the base class
become private members of the derived
class.
Inheritance in C++
 In C++ all the five types of inheritances are
applicable.
 Friend functions and constructors can’t be
inherited.
 The general syntax of inheritance is:
class derived-class-name : visibility-mode base-
class-name
{
…// members of derived class
};
Inheritance in Java
 The general syntax of inheritance is:
Class Subclass-name extends superclass-
name
{
//methods and fields
}
 The keyword extends indicates that we are
making a new class that derives from an
existing class.
 Multiple and hybrid inheritance is not
supported. This reduces the program
complexity.
 Constructors are not inherited by a subclass.
Inheritance in Python
 Instances inherit from classes, and classes
inherit from super classes.
 Python supports a limited form of multiple
inheritance.
 The syntax for inheritance in python is:
class DerivedClassname
(BaseClassName):
<statement-1>
.
<statement-N>
Inheritance in ADA
 In Ada 95 terminology, types that can have
parents or children are termed “tagged
types”, and have the keyword “tagged” as
part of their definition.
 If we don't redefine a subprogram for a
given type, the closest ancestor's defined
subprogram will be used.
Advantages
 We save time because much of the code
needed for our class is already written.
 We can extend and revise a parent class
without corrupting the existing parent class
features.
Disadvantages
 Removing or swapping out a superclass
will usually break subclasses.
 It's inflexible.
 Inheritance relationships generally can't
be altered at runtime.
Inheritance in oops

More Related Content

What's hot

Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Gajendra Singh Thakur
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++HalaiHansaika
 
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...cprogrammings
 
Java Inheritance
Java InheritanceJava Inheritance
Java InheritanceVINOTH R
 
Access specifier
Access specifierAccess specifier
Access specifierzindadili
 
Ppt on this and super keyword
Ppt on this and super keywordPpt on this and super keyword
Ppt on this and super keywordtanu_jaswal
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++rprajat007
 
class and objects
class and objectsclass and objects
class and objectsPayel Guria
 
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...Simplilearn
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++Vishal Patil
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 

What's hot (20)

Inheritance In Java
Inheritance In JavaInheritance In Java
Inheritance In Java
 
Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
Single inheritance
Single inheritanceSingle inheritance
Single inheritance
 
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
 
Java Inheritance
Java InheritanceJava Inheritance
Java Inheritance
 
Access specifier
Access specifierAccess specifier
Access specifier
 
Inheritance
InheritanceInheritance
Inheritance
 
Ppt on this and super keyword
Ppt on this and super keywordPpt on this and super keyword
Ppt on this and super keyword
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
class and objects
class and objectsclass and objects
class and objects
 
inheritance c++
inheritance c++inheritance c++
inheritance c++
 
Inheritance
InheritanceInheritance
Inheritance
 
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Java Basic Oops Concept
Java Basic Oops ConceptJava Basic Oops Concept
Java Basic Oops Concept
 
Encapsulation C++
Encapsulation C++Encapsulation C++
Encapsulation C++
 

Viewers also liked (20)

Inheritance
InheritanceInheritance
Inheritance
 
Inheritance, Object Oriented Programming
Inheritance, Object Oriented ProgrammingInheritance, Object Oriented Programming
Inheritance, Object Oriented Programming
 
Inheritance in C++
Inheritance in C++Inheritance in C++
Inheritance in C++
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
C++ Inheritance
C++ InheritanceC++ Inheritance
C++ Inheritance
 
Constructors & destructors
Constructors & destructorsConstructors & destructors
Constructors & destructors
 
Inheritance
InheritanceInheritance
Inheritance
 
Constructor & destructor
Constructor & destructorConstructor & destructor
Constructor & destructor
 
Inheritance
InheritanceInheritance
Inheritance
 
Types of Inheritance
Types of InheritanceTypes of Inheritance
Types of Inheritance
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Constructor & Destructor
Constructor & DestructorConstructor & Destructor
Constructor & Destructor
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Inheritance OOP Concept in C++.
Inheritance OOP Concept in C++.Inheritance OOP Concept in C++.
Inheritance OOP Concept in C++.
 
Csharp4 inheritance
Csharp4 inheritanceCsharp4 inheritance
Csharp4 inheritance
 
4GMAT Diagnostic Test Q14 - Problem Solving - Coordinate Geometry
4GMAT Diagnostic Test Q14 - Problem Solving - Coordinate Geometry4GMAT Diagnostic Test Q14 - Problem Solving - Coordinate Geometry
4GMAT Diagnostic Test Q14 - Problem Solving - Coordinate Geometry
 
Constructor and destructor
Constructor  and  destructor Constructor  and  destructor
Constructor and destructor
 
C# basics training (Inheritance)
C# basics training (Inheritance)C# basics training (Inheritance)
C# basics training (Inheritance)
 

Similar to Inheritance in oops

Similar to Inheritance in oops (20)

Final presentation programming
Final presentation programmingFinal presentation programming
Final presentation programming
 
lecture 6.pdf
lecture 6.pdflecture 6.pdf
lecture 6.pdf
 
java_vyshali.pdf
java_vyshali.pdfjava_vyshali.pdf
java_vyshali.pdf
 
C++ Inheritance.pptx
C++ Inheritance.pptxC++ Inheritance.pptx
C++ Inheritance.pptx
 
Inheritance
InheritanceInheritance
Inheritance
 
inheritance
inheritanceinheritance
inheritance
 
Inheritance
InheritanceInheritance
Inheritance
 
OOP Assign No.03(AP).pdf
OOP Assign No.03(AP).pdfOOP Assign No.03(AP).pdf
OOP Assign No.03(AP).pdf
 
Inheritance
InheritanceInheritance
Inheritance
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 
Programming Lesson by Slidesgo.pptx
Programming Lesson by Slidesgo.pptxProgramming Lesson by Slidesgo.pptx
Programming Lesson by Slidesgo.pptx
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Inheritance
InheritanceInheritance
Inheritance
 
Java - Inheritance Concepts
Java - Inheritance ConceptsJava - Inheritance Concepts
Java - Inheritance Concepts
 
Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance used in java
Inheritance used in javaInheritance used in java
Inheritance used in java
 
Python-Inheritance.pptx
Python-Inheritance.pptxPython-Inheritance.pptx
Python-Inheritance.pptx
 
Java(inheritance)
Java(inheritance)Java(inheritance)
Java(inheritance)
 

More from Hirra Sultan

Superconductors And their Applications
Superconductors And their ApplicationsSuperconductors And their Applications
Superconductors And their ApplicationsHirra Sultan
 
Attribute oriented analysis
Attribute oriented analysisAttribute oriented analysis
Attribute oriented analysisHirra Sultan
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow TestingHirra Sultan
 
Monopolistic Competition
Monopolistic CompetitionMonopolistic Competition
Monopolistic CompetitionHirra Sultan
 
Unified modelling language (UML)
Unified modelling language (UML)Unified modelling language (UML)
Unified modelling language (UML)Hirra Sultan
 

More from Hirra Sultan (8)

Processes
ProcessesProcesses
Processes
 
report
reportreport
report
 
Presentation
PresentationPresentation
Presentation
 
Superconductors And their Applications
Superconductors And their ApplicationsSuperconductors And their Applications
Superconductors And their Applications
 
Attribute oriented analysis
Attribute oriented analysisAttribute oriented analysis
Attribute oriented analysis
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow Testing
 
Monopolistic Competition
Monopolistic CompetitionMonopolistic Competition
Monopolistic Competition
 
Unified modelling language (UML)
Unified modelling language (UML)Unified modelling language (UML)
Unified modelling language (UML)
 

Recently uploaded

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
 
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
 
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
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
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
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
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
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
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
 
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
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
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
 
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)

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
 
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
 
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...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
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
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.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...
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
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
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
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
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
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...
 
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
 

Inheritance in oops

  • 1. Sharda University Department Of Computer Science And Engineering School Of Engineering And Technology Greater Noida, U. P.
  • 2. Presented By Hirra Sultan CSE-B 2nd year Roll No. 120101091 Enrollment No. 2012017740 Supervisor: Mr. A. K. Sahoo prlhirr@gmail.com
  • 3. Introduction Background  The first OOP language designed for the first personal computer was smalltalk.  When OOP was integrated into C language, the resulting language was called C++ and it became the first object- oriented language to be widely used commercially.  Later java and other OOP languages were developed.
  • 4. Concept of Inheritance  Inheritance is that feature of an OOP language which allows reusability of code of a class and is considered corner stone of OOP languages.  Using inheritance, we can create a general class that defines traits common to a set of related items.  This class may then be inherited by other, more specific classes, each adding only those things that are unique to the inheriting class.
  • 5.  Base class: The class which gets inherited is called a base class. The code of this class is passed on to subclasses where it is reused.  Derived class: A subclass is a derived class which inherits the base class and uses its member functions.  Un-inheritable class: A class may be declared as un-inheritable by adding certain class modifiers to the class declaration before the "class" keyword and the class identifier declaration. Such sealed classes restrict reusability. Definitions
  • 6. Types of Inheritance  Single Inheritance: In single inheritance there is only one super class and only one sub class.  Multi-level inheritance: In multi-level inheritance a derived class is inherited by another class thus making multiple levels.
  • 7.  Multiple Inheritance: A class can inherit the attributes of two or more classes. This is known as multiple inheritance.  Hierarchical inheritance: When a base class is inherited by multiple derived classes it is called hierarchical inheritance.  Hybrid inheritance: This is a mixture of two or more inheritances in a single code.
  • 8. Inheritance may be derived in three forms which decides the way inherited data members can be used.  Public Inheritance: Public members of the base class become public members of the derived class and protected members of the base class become protected members of the derived class.
  • 9.  Protected Inheritance: When deriving from a protected base class, public and protected members of the base class become protected members of the derived class.  Private Inheritance: When deriving from a private base class, public and protected members of the base class become private members of the derived class.
  • 10. Inheritance in C++  In C++ all the five types of inheritances are applicable.  Friend functions and constructors can’t be inherited.  The general syntax of inheritance is: class derived-class-name : visibility-mode base- class-name { …// members of derived class };
  • 11. Inheritance in Java  The general syntax of inheritance is: Class Subclass-name extends superclass- name { //methods and fields }
  • 12.  The keyword extends indicates that we are making a new class that derives from an existing class.  Multiple and hybrid inheritance is not supported. This reduces the program complexity.  Constructors are not inherited by a subclass.
  • 13. Inheritance in Python  Instances inherit from classes, and classes inherit from super classes.  Python supports a limited form of multiple inheritance.  The syntax for inheritance in python is: class DerivedClassname (BaseClassName): <statement-1> . <statement-N>
  • 14. Inheritance in ADA  In Ada 95 terminology, types that can have parents or children are termed “tagged types”, and have the keyword “tagged” as part of their definition.  If we don't redefine a subprogram for a given type, the closest ancestor's defined subprogram will be used.
  • 15. Advantages  We save time because much of the code needed for our class is already written.  We can extend and revise a parent class without corrupting the existing parent class features.
  • 16. Disadvantages  Removing or swapping out a superclass will usually break subclasses.  It's inflexible.  Inheritance relationships generally can't be altered at runtime.