SlideShare a Scribd company logo
Object Oriented
Programming
- Python
Agenda
Python
• Introduction
• What is Class
• Inheritance and types
• Polymorphism
• Abstraction
• Encapsulation
2
Introduction
The main concept of OOPs is to bind the data and
the functions that work on that together as a
single unit so that no other part of the code can
access this data.
Python Class
A class is a collection of objects. A class contains the
blueprints or the prototype from which the objects are being
created.
python
3
Class
Syntax of Class:
class ClassName:
# Statement-1
.
# Statement-N
• Classes are created by keyword class.
• Attributes are the variables that belong to a class.
• Attributes are always public and can be accessed using the dot (.) operator.
python
4
Eg: class Dog:
sound = "bark"
…....
Object
• The object is an entity that has a state and behavior associated with it.
• It may be any real-world object like a mouse, keyboard, chair, table, pen, etc.
Integers, strings, floating-point numbers, even arrays, and dictionaries, are all
objects.
• More specifically, any single integer or any single string is an object.
• The number 12 is an object, the string “Hello, world” is an object
python
5
Object
Object Consists of:
• State
• Behavior
• Identity
Example:
• The identity can be considered as the name of the dog.
• State or Attributes can be considered as the breed, age, or color of the dog.
• The behavior can be considered as to whether the dog is eating or sleeping.
python
6
Constructors and Destructors
Constructors
• Used for instantiating an object.
• The task of constructors is to initialize(assign values)
to the data members of the class when an object of
the class is created.
• In Python the __init__() method is called the
constructor and is always called when an object is
created.
Syntax of constructor declaration :
def __init__(self):
# body of the constructor
Types:
Default Parameterized constructor
Destructors
• Destructors are called when an object gets destroyed.
• In Python, destructors are not needed as much as in C++ because
Python has a garbage collector that handles memory management
automatically.
• The __del__() method is a known as a destructor method in Python.
It is called when all references to the object have been deleted i.e
when an object is garbage collected.
Syntax of destructor declaration :
def __del__(self):
# body of destructor
7
Oops Concepts
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
Python
8
Inheritance
Inheritance is defined as the mechanism of inheriting
the properties of the base class to the child class
The Parent class is the class which provides features
to another class. The parent class is also known
as Base class or Superclass.
The Child class is the class which receives features
from another class. The child class is also known as
the Derived Class or Subclass.
Python
9
Types of Inheritance
• Single
• Multiple
• Multilevel
• Hierarchical
• Hybrid
Single Inheritance
Single inheritance enables a derived class to
inherit properties from a single parent class.
10
PYTHON
Multiple Inheritance
• A class can be derived from more than one base class
this type of inheritance is called multiple inheritances.
• In multiple inheritances, all the features of the base
classes are inherited into the derived class.
11
PYTHON
Multilevel Inheritance
• In multilevel inheritance, features of the base class
and the derived class are further inherited into the
new derived class.
• This is similar to a relationship representing a
child and a grandfather.
12
PYTHON
Hierarchical Inheritance
• When more than one derived class are created from a
single base this type of inheritance is called hierarchical
inheritance.
• In this program, we have a parent (base) class and two or
more child(derived) classes.
13
PYTHON
Hybrid Inheritance
• Inheritance consisting of multiple
types of inheritance is called
hybrid inheritance.
14
PYTHON
Polymorphism
• Polymorphism simply means having many forms.
• This code demonstrates the concept of inheritance
and method overriding in Python classes.
• It shows how subclasses can override methods
defined in their parent class to provide specific
behavior while still inheriting other methods from
the parent class.
15
PYTHON
Encapsulation
• Encapsulation is a mechanism of wrapping the data (variables) and
code acting on the data (methods) together as a single unit.
• Access modifiers in the concept of Encapsulation and data hiding.
• Public: Accessible from inside or outside the class.
• Private: Accessible only inside class. Define a private member by
prefixing the member name with two underscores. Eg: __age
• Protected: Accessible. from inside the class and its sub-class.
Define a protected member by prefixing the member name with an
underscore Eg: _points
16
Access Modifiers
•Public
•Private
•Protected
Abstraction
• It hides unnecessary code details from the user.
• Also, when we do not want to give out sensitive
parts of our code implementation and this is where
data abstraction came.
17
Python
SUMMARY
Python
• These are various Object Oriented Programming
concepts in Python.
• Online Reference:
W3schools
GeeksforGeeks
18
Thank You
Any Queries ??

More Related Content

Similar to Object-Oriented Programming System presentation (20)

OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
SmritiSharma901052
 
python1 object oriented programming.pptx
python1 object oriented programming.pptxpython1 object oriented programming.pptx
python1 object oriented programming.pptx
PravinBhargav1
 
UNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHON
UNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHONUNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHON
UNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHON
drkangurajuphd
 
software construction and development week 3 Python lists, tuples, dictionari...
software construction and development week 3 Python lists, tuples, dictionari...software construction and development week 3 Python lists, tuples, dictionari...
software construction and development week 3 Python lists, tuples, dictionari...
MuhammadBilalAjmal2
 
PYTHON OBJECT-ORIENTED PROGRAMMING.pptx
PYTHON  OBJECT-ORIENTED PROGRAMMING.pptxPYTHON  OBJECT-ORIENTED PROGRAMMING.pptx
PYTHON OBJECT-ORIENTED PROGRAMMING.pptx
hpearl130
 
Unit - 3.pptx
Unit - 3.pptxUnit - 3.pptx
Unit - 3.pptx
Kongunadu College of Engineering and Technology
 
Object Oriented Programming in Python.pptx
Object Oriented Programming in Python.pptxObject Oriented Programming in Python.pptx
Object Oriented Programming in Python.pptx
grpvasundhara1993
 
Unit – V Object Oriented Programming in Python.pptx
Unit – V Object Oriented Programming in Python.pptxUnit – V Object Oriented Programming in Python.pptx
Unit – V Object Oriented Programming in Python.pptx
YugandharaNalavade
 
OOP Concepts Python with code refrences.pptx
OOP Concepts Python with code refrences.pptxOOP Concepts Python with code refrences.pptx
OOP Concepts Python with code refrences.pptx
SofiMusic
 
Object-Oriented Programming in Python.pptx
Object-Oriented Programming in Python.pptxObject-Oriented Programming in Python.pptx
Object-Oriented Programming in Python.pptx
ssuser4ab3a2
 
Inheritance
InheritanceInheritance
Inheritance
JayanthiNeelampalli
 
Object oriented Programning Lanuagues in text format.
Object oriented Programning Lanuagues in text format.Object oriented Programning Lanuagues in text format.
Object oriented Programning Lanuagues in text format.
SravaniSravani53
 
Introduction to OOP_Python_Lecture1.pptx
Introduction to OOP_Python_Lecture1.pptxIntroduction to OOP_Python_Lecture1.pptx
Introduction to OOP_Python_Lecture1.pptx
cpics
 
object oriented programming(PYTHON)
object oriented programming(PYTHON)object oriented programming(PYTHON)
object oriented programming(PYTHON)
Jyoti shukla
 
Oop concepts in python
Oop concepts in pythonOop concepts in python
Oop concepts in python
baabtra.com - No. 1 supplier of quality freshers
 
مقدمة بايثون .pptx
مقدمة بايثون .pptxمقدمة بايثون .pptx
مقدمة بايثون .pptx
AlmutasemBillahAlwas
 
Object Oriented Programming in Python
Object Oriented Programming in PythonObject Oriented Programming in Python
Object Oriented Programming in Python
Sujith Kumar
 
Python-Classes.pptx
Python-Classes.pptxPython-Classes.pptx
Python-Classes.pptx
Karudaiyar Ganapathy
 
OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........
FerryKemperman
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
SmritiSharma901052
 
python1 object oriented programming.pptx
python1 object oriented programming.pptxpython1 object oriented programming.pptx
python1 object oriented programming.pptx
PravinBhargav1
 
UNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHON
UNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHONUNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHON
UNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHON
drkangurajuphd
 
software construction and development week 3 Python lists, tuples, dictionari...
software construction and development week 3 Python lists, tuples, dictionari...software construction and development week 3 Python lists, tuples, dictionari...
software construction and development week 3 Python lists, tuples, dictionari...
MuhammadBilalAjmal2
 
PYTHON OBJECT-ORIENTED PROGRAMMING.pptx
PYTHON  OBJECT-ORIENTED PROGRAMMING.pptxPYTHON  OBJECT-ORIENTED PROGRAMMING.pptx
PYTHON OBJECT-ORIENTED PROGRAMMING.pptx
hpearl130
 
Object Oriented Programming in Python.pptx
Object Oriented Programming in Python.pptxObject Oriented Programming in Python.pptx
Object Oriented Programming in Python.pptx
grpvasundhara1993
 
Unit – V Object Oriented Programming in Python.pptx
Unit – V Object Oriented Programming in Python.pptxUnit – V Object Oriented Programming in Python.pptx
Unit – V Object Oriented Programming in Python.pptx
YugandharaNalavade
 
OOP Concepts Python with code refrences.pptx
OOP Concepts Python with code refrences.pptxOOP Concepts Python with code refrences.pptx
OOP Concepts Python with code refrences.pptx
SofiMusic
 
Object-Oriented Programming in Python.pptx
Object-Oriented Programming in Python.pptxObject-Oriented Programming in Python.pptx
Object-Oriented Programming in Python.pptx
ssuser4ab3a2
 
Object oriented Programning Lanuagues in text format.
Object oriented Programning Lanuagues in text format.Object oriented Programning Lanuagues in text format.
Object oriented Programning Lanuagues in text format.
SravaniSravani53
 
Introduction to OOP_Python_Lecture1.pptx
Introduction to OOP_Python_Lecture1.pptxIntroduction to OOP_Python_Lecture1.pptx
Introduction to OOP_Python_Lecture1.pptx
cpics
 
object oriented programming(PYTHON)
object oriented programming(PYTHON)object oriented programming(PYTHON)
object oriented programming(PYTHON)
Jyoti shukla
 
Object Oriented Programming in Python
Object Oriented Programming in PythonObject Oriented Programming in Python
Object Oriented Programming in Python
Sujith Kumar
 
OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........OOP in Python, a beginners guide..........
OOP in Python, a beginners guide..........
FerryKemperman
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 

Recently uploaded (20)

How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time OffHow to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 SlidesPOS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
TV Shows and web-series quiz | QUIZ CLUB OF PSGCAS | 13TH MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptxRai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Gibson "Secrets to Changing Behaviour in Scholarly Communication: A 2025 NISO...
Gibson "Secrets to Changing Behaviour in Scholarly Communication: A 2025 NISO...Gibson "Secrets to Changing Behaviour in Scholarly Communication: A 2025 NISO...
Gibson "Secrets to Changing Behaviour in Scholarly Communication: A 2025 NISO...
National Information Standards Organization (NISO)
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Celine George
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in IndiaSmart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
Strengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptxStrengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptx
SteffMusniQuiballo
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad LevelLDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDM & Mia eStudios
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
Fatman Book HD Pdf by aayush songare.pdf
Fatman Book  HD Pdf by aayush songare.pdfFatman Book  HD Pdf by aayush songare.pdf
Fatman Book HD Pdf by aayush songare.pdf
Aayush Songare
 
How to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time OffHow to Manage Allocations in Odoo 18 Time Off
How to Manage Allocations in Odoo 18 Time Off
Celine George
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 SlidesPOS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
Trends Spotting Strategic foresight for tomorrow’s education systems - Debora...
EduSkills OECD
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdfBlack and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdfForestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
Forestry Model Exit Exam_2025_Wollega University, Gimbi Campus.pdf
ChalaKelbessa
 
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Celine George
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in IndiaSmart Borrowing: Everything You Need to Know About Short Term Loans in India
Smart Borrowing: Everything You Need to Know About Short Term Loans in India
fincrifcontent
 
Strengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptxStrengthened Senior High School - Landas Tool Kit.pptx
Strengthened Senior High School - Landas Tool Kit.pptx
SteffMusniQuiballo
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad LevelLDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDMMIA Reiki Yoga S8 Free Workshop Grad Level
LDM & Mia eStudios
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptxPests of Rice: Damage, Identification, Life history, and Management.pptx
Pests of Rice: Damage, Identification, Life history, and Management.pptx
Arshad Shaikh
 
Fatman Book HD Pdf by aayush songare.pdf
Fatman Book  HD Pdf by aayush songare.pdfFatman Book  HD Pdf by aayush songare.pdf
Fatman Book HD Pdf by aayush songare.pdf
Aayush Songare
 
Ad

Object-Oriented Programming System presentation

  • 2. Agenda Python • Introduction • What is Class • Inheritance and types • Polymorphism • Abstraction • Encapsulation 2
  • 3. Introduction The main concept of OOPs is to bind the data and the functions that work on that together as a single unit so that no other part of the code can access this data. Python Class A class is a collection of objects. A class contains the blueprints or the prototype from which the objects are being created. python 3
  • 4. Class Syntax of Class: class ClassName: # Statement-1 . # Statement-N • Classes are created by keyword class. • Attributes are the variables that belong to a class. • Attributes are always public and can be accessed using the dot (.) operator. python 4 Eg: class Dog: sound = "bark" …....
  • 5. Object • The object is an entity that has a state and behavior associated with it. • It may be any real-world object like a mouse, keyboard, chair, table, pen, etc. Integers, strings, floating-point numbers, even arrays, and dictionaries, are all objects. • More specifically, any single integer or any single string is an object. • The number 12 is an object, the string “Hello, world” is an object python 5
  • 6. Object Object Consists of: • State • Behavior • Identity Example: • The identity can be considered as the name of the dog. • State or Attributes can be considered as the breed, age, or color of the dog. • The behavior can be considered as to whether the dog is eating or sleeping. python 6
  • 7. Constructors and Destructors Constructors • Used for instantiating an object. • The task of constructors is to initialize(assign values) to the data members of the class when an object of the class is created. • In Python the __init__() method is called the constructor and is always called when an object is created. Syntax of constructor declaration : def __init__(self): # body of the constructor Types: Default Parameterized constructor Destructors • Destructors are called when an object gets destroyed. • In Python, destructors are not needed as much as in C++ because Python has a garbage collector that handles memory management automatically. • The __del__() method is a known as a destructor method in Python. It is called when all references to the object have been deleted i.e when an object is garbage collected. Syntax of destructor declaration : def __del__(self): # body of destructor 7
  • 8. Oops Concepts • Inheritance • Polymorphism • Abstraction • Encapsulation Python 8
  • 9. Inheritance Inheritance is defined as the mechanism of inheriting the properties of the base class to the child class The Parent class is the class which provides features to another class. The parent class is also known as Base class or Superclass. The Child class is the class which receives features from another class. The child class is also known as the Derived Class or Subclass. Python 9 Types of Inheritance • Single • Multiple • Multilevel • Hierarchical • Hybrid
  • 10. Single Inheritance Single inheritance enables a derived class to inherit properties from a single parent class. 10 PYTHON
  • 11. Multiple Inheritance • A class can be derived from more than one base class this type of inheritance is called multiple inheritances. • In multiple inheritances, all the features of the base classes are inherited into the derived class. 11 PYTHON
  • 12. Multilevel Inheritance • In multilevel inheritance, features of the base class and the derived class are further inherited into the new derived class. • This is similar to a relationship representing a child and a grandfather. 12 PYTHON
  • 13. Hierarchical Inheritance • When more than one derived class are created from a single base this type of inheritance is called hierarchical inheritance. • In this program, we have a parent (base) class and two or more child(derived) classes. 13 PYTHON
  • 14. Hybrid Inheritance • Inheritance consisting of multiple types of inheritance is called hybrid inheritance. 14 PYTHON
  • 15. Polymorphism • Polymorphism simply means having many forms. • This code demonstrates the concept of inheritance and method overriding in Python classes. • It shows how subclasses can override methods defined in their parent class to provide specific behavior while still inheriting other methods from the parent class. 15 PYTHON
  • 16. Encapsulation • Encapsulation is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. • Access modifiers in the concept of Encapsulation and data hiding. • Public: Accessible from inside or outside the class. • Private: Accessible only inside class. Define a private member by prefixing the member name with two underscores. Eg: __age • Protected: Accessible. from inside the class and its sub-class. Define a protected member by prefixing the member name with an underscore Eg: _points 16 Access Modifiers •Public •Private •Protected
  • 17. Abstraction • It hides unnecessary code details from the user. • Also, when we do not want to give out sensitive parts of our code implementation and this is where data abstraction came. 17 Python
  • 18. SUMMARY Python • These are various Object Oriented Programming concepts in Python. • Online Reference: W3schools GeeksforGeeks 18