SlideShare a Scribd company logo
3
Most read
11
Most read
12
Most read
CLASS OBJECT
&
INHERITANCE
I N P Y T H O N
CONTENTS
 Class
 Object
 Inheritance
WHAT ARE CLASSES AND OBJECTS IN PYTHON?
Python is an object oriented programming language. Unlike procedure
oriented programming, where the main emphasis is on functions, object
oriented programming stress on objects.
Object is simply a collection of data (variables) and methods (functions) that
act on those data. And, class is a blueprint for the object.
We can think of class as a sketch (prototype) of a house. It contains all the
details about the floors, doors, windows etc. Based on these descriptions we
build the house. House is the object.
As, many houses can be made from a description, we can create many
objects from a class. An object is also called an instance of a class and the
process of creating this object is called instantiation.
DEFINING A CLASS IN PYTHON
Like function definitions begin with the keyword def, in Python, we define a class
using the keyword class.
Here is a simple class definition.
CREATING AN OBJECT IN PYTHON
We saw that the class object could be used to access different attributes.
It can also be used to create new object instances (instantiation) of that class. The
procedure to create an object is similar to a function call.
EXAMPLE
CLASS OBJECT AND INHERITANCE IN PYTHON
WHAT IS INHERITANCE?
Inheritance is a powerful feature in object oriented programming.
It refers to defining a new class with little or no modification to an existing class. The
new class is called derived (or child) class and the one from which it inherits is called
the base (or parent) class.
PYTHON INHERITANCE SYNTAX
TYPES OF INHERITANCE
 Single Inheritance
 Multiple Inheritance
 Multilevel Inheritance
 Hybrid Inheritance
 Hierarchical Inheritance
SINGLE INHERITANCE
 In which there is one base class and one derived class
MULTIPLE INHERITANCE
 Multiple inheritance is possible in python
 A class can be derived from more then one base classes. The syntax for multiple
inheritance is similar to single inheritance
 Here is an example of multiple inheritance
CLASS OBJECT AND INHERITANCE IN PYTHON
MULTILEVEL INHERITANCE
 Multilevel inheritance is also possible in Python like other Object Oriented
programming languages. We can inherit a derived class from another derived class,
this process is known as multilevel inheritance. In Python, multilevel inheritance can
be done at any depth.
CLASS OBJECT AND INHERITANCE IN PYTHON
HYBRID INHERITANCE
CLASS OBJECT AND INHERITANCE IN PYTHON
HIERARCHICAL INHERITANCE
 In which there is single base class and multiple derived class
CLASS OBJECT AND INHERITANCE IN PYTHON
THANK YOU

More Related Content

What's hot (20)

PPTX
Class, object and inheritance in python
Santosh Verma
 
PPTX
Chapter 07 inheritance
Praveen M Jigajinni
 
PPTX
OOPS Basics With Example
Thooyavan Venkatachalam
 
PDF
Python programming : Classes objects
Emertxe Information Technologies Pvt Ltd
 
PPTX
Basics of Object Oriented Programming in Python
Sujith Kumar
 
PPTX
Classes and objects
Anil Kumar
 
PDF
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
PPTX
Python: Modules and Packages
Damian T. Gordon
 
PDF
Constructors and destructors
Nilesh Dalvi
 
PPTX
Object oriented programming in python
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 06 constructors and destructors
Praveen M Jigajinni
 
PPTX
File Handling Python
Akhil Kaushik
 
PPT
Class and object in C++
rprajat007
 
PPTX
Object Oriented Programming in Python
Sujith Kumar
 
PPTX
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
 
PDF
Class and Objects in Java
Spotle.ai
 
PPTX
classes and objects in C++
HalaiHansaika
 
PDF
C++ OOPS Concept
Boopathi K
 
PPTX
Types of methods in python
Aravindreddy Mokireddy
 
Class, object and inheritance in python
Santosh Verma
 
Chapter 07 inheritance
Praveen M Jigajinni
 
OOPS Basics With Example
Thooyavan Venkatachalam
 
Python programming : Classes objects
Emertxe Information Technologies Pvt Ltd
 
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Classes and objects
Anil Kumar
 
Python Functions Tutorial | Working With Functions In Python | Python Trainin...
Edureka!
 
Python: Modules and Packages
Damian T. Gordon
 
Constructors and destructors
Nilesh Dalvi
 
Object oriented programming in python
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 06 constructors and destructors
Praveen M Jigajinni
 
File Handling Python
Akhil Kaushik
 
Class and object in C++
rprajat007
 
Object Oriented Programming in Python
Sujith Kumar
 
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
 
Class and Objects in Java
Spotle.ai
 
classes and objects in C++
HalaiHansaika
 
C++ OOPS Concept
Boopathi K
 
Types of methods in python
Aravindreddy Mokireddy
 

Similar to CLASS OBJECT AND INHERITANCE IN PYTHON (20)

PPTX
Problem solving with python programming OOP's Concept
rohitsharma24121
 
PPTX
Class and Objects in python programming.pptx
Rajtherock
 
PDF
Unit 3-Classes ,Objects and Inheritance.pdf
Harsha Patil
 
PPTX
arthimetic operator,classes,objects,instant
ssuser77162c
 
PPT
inheritance in python with full detail.ppt
ssuser7b0a4d
 
PPTX
Python programming computer science and engineering
IRAH34
 
PPTX
Object Oriented Programming.pptx
SAICHARANREDDYN
 
PDF
Object-Oriented Programming System presentation
PavanKumarPathipati
 
PDF
Object oriented Programning Lanuagues in text format.
SravaniSravani53
 
PDF
All about python Inheritance.python codingdf
adipapai181023
 
PPTX
python1 object oriented programming.pptx
PravinBhargav1
 
PPTX
OOPS.pptx
NitinSharma134320
 
PPTX
PYTHON OBJECT-ORIENTED PROGRAMMING.pptx
hpearl130
 
PPTX
INHERITANCE ppt of python.pptx & PYTHON INHERITANCE PPT
deepuranjankumar08
 
PPTX
oops-in-python-240412044200-2d5c6552.pptx
anilvarsha1
 
PPTX
OOP concepts -in-Python programming language
SmritiSharma901052
 
PDF
Inheritance and polymorphism oops concepts in python
deepalishinkar1
 
PPTX
601109769-Pythondyttcjycvuv-Inheritance .pptx
srinivasa gowda
 
PPTX
software construction and development week 3 Python lists, tuples, dictionari...
MuhammadBilalAjmal2
 
PPTX
Inheritance
JayanthiNeelampalli
 
Problem solving with python programming OOP's Concept
rohitsharma24121
 
Class and Objects in python programming.pptx
Rajtherock
 
Unit 3-Classes ,Objects and Inheritance.pdf
Harsha Patil
 
arthimetic operator,classes,objects,instant
ssuser77162c
 
inheritance in python with full detail.ppt
ssuser7b0a4d
 
Python programming computer science and engineering
IRAH34
 
Object Oriented Programming.pptx
SAICHARANREDDYN
 
Object-Oriented Programming System presentation
PavanKumarPathipati
 
Object oriented Programning Lanuagues in text format.
SravaniSravani53
 
All about python Inheritance.python codingdf
adipapai181023
 
python1 object oriented programming.pptx
PravinBhargav1
 
PYTHON OBJECT-ORIENTED PROGRAMMING.pptx
hpearl130
 
INHERITANCE ppt of python.pptx & PYTHON INHERITANCE PPT
deepuranjankumar08
 
oops-in-python-240412044200-2d5c6552.pptx
anilvarsha1
 
OOP concepts -in-Python programming language
SmritiSharma901052
 
Inheritance and polymorphism oops concepts in python
deepalishinkar1
 
601109769-Pythondyttcjycvuv-Inheritance .pptx
srinivasa gowda
 
software construction and development week 3 Python lists, tuples, dictionari...
MuhammadBilalAjmal2
 
Inheritance
JayanthiNeelampalli
 
Ad

Recently uploaded (20)

PDF
PRIZ Academy - Process functional modelling
PRIZ Guru
 
PDF
How to Buy Verified CashApp Accounts IN 2025
Buy Verified CashApp Accounts
 
PPTX
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
PDF
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
PPT
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
 
PDF
bs-en-12390-3 testing hardened concrete.pdf
ADVANCEDCONSTRUCTION
 
PPTX
Functions in Python Programming Language
BeulahS2
 
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
 
PPTX
Explore USA’s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
 
PDF
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
PPTX
Work at Height training for workers .pptx
cecos12
 
PPTX
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
 
PDF
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
PDF
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
PPTX
Precooling and Refrigerated storage.pptx
ThongamSunita
 
PPTX
Computer network Computer network Computer network Computer network
Shrikant317689
 
PPTX
CST413 KTU S7 CSE Machine Learning Neural Networks and Support Vector Machine...
resming1
 
PDF
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
DOCX
Engineering Geology Field Report to Malekhu .docx
justprashant567
 
PRIZ Academy - Process functional modelling
PRIZ Guru
 
How to Buy Verified CashApp Accounts IN 2025
Buy Verified CashApp Accounts
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
 
bs-en-12390-3 testing hardened concrete.pdf
ADVANCEDCONSTRUCTION
 
Functions in Python Programming Language
BeulahS2
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
 
Explore USA’s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
Work at Height training for workers .pptx
cecos12
 
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
 
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
Precooling and Refrigerated storage.pptx
ThongamSunita
 
Computer network Computer network Computer network Computer network
Shrikant317689
 
CST413 KTU S7 CSE Machine Learning Neural Networks and Support Vector Machine...
resming1
 
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
Engineering Geology Field Report to Malekhu .docx
justprashant567
 
Ad

CLASS OBJECT AND INHERITANCE IN PYTHON

  • 3. WHAT ARE CLASSES AND OBJECTS IN PYTHON? Python is an object oriented programming language. Unlike procedure oriented programming, where the main emphasis is on functions, object oriented programming stress on objects. Object is simply a collection of data (variables) and methods (functions) that act on those data. And, class is a blueprint for the object. We can think of class as a sketch (prototype) of a house. It contains all the details about the floors, doors, windows etc. Based on these descriptions we build the house. House is the object. As, many houses can be made from a description, we can create many objects from a class. An object is also called an instance of a class and the process of creating this object is called instantiation.
  • 4. DEFINING A CLASS IN PYTHON Like function definitions begin with the keyword def, in Python, we define a class using the keyword class. Here is a simple class definition.
  • 5. CREATING AN OBJECT IN PYTHON We saw that the class object could be used to access different attributes. It can also be used to create new object instances (instantiation) of that class. The procedure to create an object is similar to a function call.
  • 8. WHAT IS INHERITANCE? Inheritance is a powerful feature in object oriented programming. It refers to defining a new class with little or no modification to an existing class. The new class is called derived (or child) class and the one from which it inherits is called the base (or parent) class.
  • 10. TYPES OF INHERITANCE  Single Inheritance  Multiple Inheritance  Multilevel Inheritance  Hybrid Inheritance  Hierarchical Inheritance
  • 11. SINGLE INHERITANCE  In which there is one base class and one derived class
  • 12. MULTIPLE INHERITANCE  Multiple inheritance is possible in python  A class can be derived from more then one base classes. The syntax for multiple inheritance is similar to single inheritance  Here is an example of multiple inheritance
  • 14. MULTILEVEL INHERITANCE  Multilevel inheritance is also possible in Python like other Object Oriented programming languages. We can inherit a derived class from another derived class, this process is known as multilevel inheritance. In Python, multilevel inheritance can be done at any depth.
  • 18. HIERARCHICAL INHERITANCE  In which there is single base class and multiple derived class