SlideShare a Scribd company logo
2
Most read
3
Most read
11
Most read
POLYMORPHISM
PRESENTED BY:
SIMRAN PARDESHI (36)
INTRODUCTION
• In programming, polymorphism means the same function name (but different
signatures) being used for different types.
• In Python, Polymorphism lets us define methods in the child class that have
the same name as the methods in the parent class. In inheritance, the child
class inherits the methods from the parent class. However, it is possible to
modify a method in a child class that it has inherited from the parent class.
Exampleof inbuilt polymorphic functions:
• CODE:
• OUTPUT:
Polymorphism with class methods:
• The below code shows how Python can use two different class types, in the same way. We create a for
loop that iterates through a tuple of objects. Then call the methods without being concerned about
which class type each object is. We assume that these methods actually exist in each class.
• CODE:
• OUTPUT:
Polymorphismwith Inheritance:
• In Python, Polymorphism lets us define methods in the child class that have the same name
as the methods in the parent class. In inheritance, the child class inherits the methods from
the parent class. However, it is possible to modify a method in a child class that it has
inherited from the parent class. This is particularly useful in cases where the method
inherited from the parent class doesn’t quite fit the child class. In such cases, we re-
implement the method in the child class. This process of re-implementing method in the
child class is known as Method Overriding.
• CODE:
• OUTPUT:
CONCLUSION
•Polymorphism is a very important concept in Object-
Oriented Programming. We can use the concept of
polymorphism while creating class methods as Python
allows different classes to have methods with the same
name.
THANK YOU!

More Related Content

PPTX
CLASS OBJECT AND INHERITANCE IN PYTHON
PPTX
Python-Encapsulation.pptx
PPTX
Python-DataAbstarction.pptx
PPTX
Object Oriented Programming in Python
PDF
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
PPTX
Class, object and inheritance in python
PDF
Python programming : Inheritance and polymorphism
PPTX
Chapter 07 inheritance
CLASS OBJECT AND INHERITANCE IN PYTHON
Python-Encapsulation.pptx
Python-DataAbstarction.pptx
Object Oriented Programming in Python
PYTHON-Chapter 3-Classes and Object-oriented Programming: MAULIK BORSANIYA
Class, object and inheritance in python
Python programming : Inheritance and polymorphism
Chapter 07 inheritance

What's hot (20)

PPTX
Python: Polymorphism
PPTX
Python-Polymorphism.pptx
PPTX
Regular expressions in Python
PPSX
Modules and packages in python
PDF
Strings in java
PPTX
Object oriented programming in python
PDF
Python programming : Classes objects
PPTX
Python-Classes.pptx
PPTX
Chapter 05 classes and objects
PPTX
Python Functions
PDF
Introduction to NumPy (PyData SV 2013)
PPTX
Object oriented programming with python
PPTX
Python Lambda Function
PPTX
File handling in Python
PPTX
Basics of Object Oriented Programming in Python
PDF
Strings in python
ODP
Python Modules
PPTX
Python: Modules and Packages
PDF
Namespaces
Python: Polymorphism
Python-Polymorphism.pptx
Regular expressions in Python
Modules and packages in python
Strings in java
Object oriented programming in python
Python programming : Classes objects
Python-Classes.pptx
Chapter 05 classes and objects
Python Functions
Introduction to NumPy (PyData SV 2013)
Object oriented programming with python
Python Lambda Function
File handling in Python
Basics of Object Oriented Programming in Python
Strings in python
Python Modules
Python: Modules and Packages
Namespaces
Ad

Similar to Polymorphism in Python (20)

PPTX
polymorphismppt for Computer Applications-211218133624.pptx
PDF
Learn Polymorphism in Python with Examples.pdf
PPTX
Polymorphism.pptx
PPTX
Polymorphism in Python
PDF
Lecture on Lecture on Python programming OP conceptsPolymorphism.pdf
PPTX
Python programming computer science and engineering
PPTX
arthimetic operator,classes,objects,instant
PPTX
Inheritance_Polymorphism_Overloading_overriding.pptx
PDF
Object oriented Programning Lanuagues in text format.
PDF
Python lecture 8
PPTX
Polymorphism.pptx
PPTX
9-_Object_Oriented_Programming_Using_Python 1.pptx
PDF
Lecture # 02 - OOP with Python Language by Muhammad Haroon
PPTX
Polymorphism_in_Python_Programming_Language
PPTX
Object Oriented Programming in Python.pptx
PPTX
object oriented programming(PYTHON)
PDF
Object Oriented programming Using Python.pdf
PDF
9-_Object_Oriented_Programming_Using_Python.pdf
PPTX
Presentation_4516_Content_Document_20250204010703PM.pptx
polymorphismppt for Computer Applications-211218133624.pptx
Learn Polymorphism in Python with Examples.pdf
Polymorphism.pptx
Polymorphism in Python
Lecture on Lecture on Python programming OP conceptsPolymorphism.pdf
Python programming computer science and engineering
arthimetic operator,classes,objects,instant
Inheritance_Polymorphism_Overloading_overriding.pptx
Object oriented Programning Lanuagues in text format.
Python lecture 8
Polymorphism.pptx
9-_Object_Oriented_Programming_Using_Python 1.pptx
Lecture # 02 - OOP with Python Language by Muhammad Haroon
Polymorphism_in_Python_Programming_Language
Object Oriented Programming in Python.pptx
object oriented programming(PYTHON)
Object Oriented programming Using Python.pdf
9-_Object_Oriented_Programming_Using_Python.pdf
Presentation_4516_Content_Document_20250204010703PM.pptx
Ad

More from Home (20)

PPTX
DIABETES PREDICTION SYSTEM .pptx
PPTX
data science pptx
PPTX
HARDWARE AND SOFTWARE.pptx
PPTX
Rock ,Paper, Scissors IAI .pptx
PPTX
Graph coloring problem(DAA).pptx
PPT
Fighting climate change using agritech
PPTX
APPLICATION OF GROUPS IN CRYPTOGRAPHY
PPTX
ECONOMIC RIGHTS.pptx
PPTX
Hamiltonian cycle in data structure 2
PPTX
Data Structures : hashing (1)
PPTX
Water scarcity and its remedial measures
PPTX
Multimedia operating system
PPTX
Dsdco IE: RISC and CISC architectures and design issues
PPTX
Dbms mini project
PDF
IMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFE
PPTX
ACTIVITY BASED LEARNING THROUGH ONLINE COLLEGE
PPTX
SMART WASTE MANAGEMENT AND RAINWATER HARVESTING
PPTX
Rock , paper and scissors game made with PYTHON
PPTX
Chemistry (biomass and recyclable polymers)
PPTX
Basic electrical engineering (Autotransformer)
DIABETES PREDICTION SYSTEM .pptx
data science pptx
HARDWARE AND SOFTWARE.pptx
Rock ,Paper, Scissors IAI .pptx
Graph coloring problem(DAA).pptx
Fighting climate change using agritech
APPLICATION OF GROUPS IN CRYPTOGRAPHY
ECONOMIC RIGHTS.pptx
Hamiltonian cycle in data structure 2
Data Structures : hashing (1)
Water scarcity and its remedial measures
Multimedia operating system
Dsdco IE: RISC and CISC architectures and design issues
Dbms mini project
IMPORTANCE OF COMMUNICATION IN PERSONAL AND PROFESSIONAL LIFE
ACTIVITY BASED LEARNING THROUGH ONLINE COLLEGE
SMART WASTE MANAGEMENT AND RAINWATER HARVESTING
Rock , paper and scissors game made with PYTHON
Chemistry (biomass and recyclable polymers)
Basic electrical engineering (Autotransformer)

Recently uploaded (20)

PPTX
OOP with Java - Java Introduction (Basics)
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
DOCX
573137875-Attendance-Management-System-original
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Structs to JSON How Go Powers REST APIs.pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPT
Project quality management in manufacturing
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
OOP with Java - Java Introduction (Basics)
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Operating System & Kernel Study Guide-1 - converted.pdf
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
573137875-Attendance-Management-System-original
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Internet of Things (IOT) - A guide to understanding
Arduino robotics embedded978-1-4302-3184-4.pdf
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Structs to JSON How Go Powers REST APIs.pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
CYBER-CRIMES AND SECURITY A guide to understanding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Project quality management in manufacturing
Lesson 3_Tessellation.pptx finite Mathematics
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx

Polymorphism in Python

  • 2. INTRODUCTION • In programming, polymorphism means the same function name (but different signatures) being used for different types. • In Python, Polymorphism lets us define methods in the child class that have the same name as the methods in the parent class. In inheritance, the child class inherits the methods from the parent class. However, it is possible to modify a method in a child class that it has inherited from the parent class.
  • 3. Exampleof inbuilt polymorphic functions: • CODE:
  • 5. Polymorphism with class methods: • The below code shows how Python can use two different class types, in the same way. We create a for loop that iterates through a tuple of objects. Then call the methods without being concerned about which class type each object is. We assume that these methods actually exist in each class. • CODE:
  • 7. Polymorphismwith Inheritance: • In Python, Polymorphism lets us define methods in the child class that have the same name as the methods in the parent class. In inheritance, the child class inherits the methods from the parent class. However, it is possible to modify a method in a child class that it has inherited from the parent class. This is particularly useful in cases where the method inherited from the parent class doesn’t quite fit the child class. In such cases, we re- implement the method in the child class. This process of re-implementing method in the child class is known as Method Overriding.
  • 10. CONCLUSION •Polymorphism is a very important concept in Object- Oriented Programming. We can use the concept of polymorphism while creating class methods as Python allows different classes to have methods with the same name.