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)

PPTX
Lecture-10_PHP-OOP.pptx
ShaownRoy1
 
PPTX
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
PPTX
Object Oriented Programming Class and Objects
rubini8582
 
PPTX
Lecture 5.pptx
AshutoshTrivedi30
 
PPTX
python1 object oriented programming.pptx
PravinBhargav1
 
PPTX
Principles and advantages of oop ppt
daxesh chauhan
 
PPTX
Object oriented programming
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Introduction to OOP concepts
Ahmed Farag
 
PPT
Object -oriented analysis and design.ppt
pierrerj05
 
PPTX
Object oriented programming
Saiful Islam Sany
 
PPTX
Oopsinphp
NithyaNithyav
 
PDF
PythonOO.pdf oo Object Oriented programming
KhadijaKhadijaAouadi
 
PPTX
Php oop (1)
Sudip Simkhada
 
PPTX
Introduction to oop and java fundamentals
AnsgarMary
 
PPTX
Introduction to OOP with java
Sujit Kumar
 
PPTX
An overview of Object Oriented Programming in C#.
prajapatrishabh421
 
PPTX
basic concepts of object oriented in python
deepalishinkar1
 
PPTX
Introduction to Object Oriented Programming in Python.pptx
eduardocehenmu
 
Lecture-10_PHP-OOP.pptx
ShaownRoy1
 
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
Object Oriented Programming Class and Objects
rubini8582
 
Lecture 5.pptx
AshutoshTrivedi30
 
python1 object oriented programming.pptx
PravinBhargav1
 
Principles and advantages of oop ppt
daxesh chauhan
 
Introduction to OOP concepts
Ahmed Farag
 
Object -oriented analysis and design.ppt
pierrerj05
 
Object oriented programming
Saiful Islam Sany
 
Oopsinphp
NithyaNithyav
 
PythonOO.pdf oo Object Oriented programming
KhadijaKhadijaAouadi
 
Php oop (1)
Sudip Simkhada
 
Introduction to oop and java fundamentals
AnsgarMary
 
Introduction to OOP with java
Sujit Kumar
 
An overview of Object Oriented Programming in C#.
prajapatrishabh421
 
basic concepts of object oriented in python
deepalishinkar1
 
Introduction to Object Oriented Programming in Python.pptx
eduardocehenmu
 

Recently uploaded (20)

PPTX
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
PPTX
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
PDF
Cooperative wireless communications 1st Edition Yan Zhang
jsphyftmkb123
 
PDF
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
PDF
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
PDF
Indian National movement PPT by Simanchala Sarab, Covering The INC(Formation,...
Simanchala Sarab, BABed(ITEP Secondary stage) in History student at GNDU Amritsar
 
PPTX
How to Manage Wins & Losses in Odoo 18 CRM
Celine George
 
PDF
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
PDF
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
PDF
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
PDF
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
PPTX
Building Powerful Agentic AI with Google ADK, MCP, RAG, and Ollama.pptx
Tamanna36
 
PDF
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
PPTX
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
PPTX
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
PPTX
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
PDF
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
PDF
Genomics Proteomics and Vaccines 1st Edition Guido Grandi (Editor)
kboqcyuw976
 
PDF
I3PM Industry Case Study Siemens on Strategic and Value-Oriented IP Management
MIPLM
 
PPTX
ENGLISH 8 REVISED K-12 CURRICULUM QUARTER 1 WEEK 1
LeomarrYsraelArzadon
 
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
Cooperative wireless communications 1st Edition Yan Zhang
jsphyftmkb123
 
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
Indian National movement PPT by Simanchala Sarab, Covering The INC(Formation,...
Simanchala Sarab, BABed(ITEP Secondary stage) in History student at GNDU Amritsar
 
How to Manage Wins & Losses in Odoo 18 CRM
Celine George
 
Free eBook ~100 Common English Proverbs (ebook) pdf.pdf
OH TEIK BIN
 
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
Wikinomics How Mass Collaboration Changes Everything Don Tapscott
wcsqyzf5909
 
CAD25 Gbadago and Fafa Presentation Revised-Aston Business School, UK.pdf
Kweku Zurek
 
Building Powerful Agentic AI with Google ADK, MCP, RAG, and Ollama.pptx
Tamanna36
 
AI-assisted IP-Design lecture from the MIPLM 2025
MIPLM
 
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
How to Add a Custom Button in Odoo 18 POS Screen
Celine George
 
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
Genomics Proteomics and Vaccines 1st Edition Guido Grandi (Editor)
kboqcyuw976
 
I3PM Industry Case Study Siemens on Strategic and Value-Oriented IP Management
MIPLM
 
ENGLISH 8 REVISED K-12 CURRICULUM QUARTER 1 WEEK 1
LeomarrYsraelArzadon
 
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