SlideShare a Scribd company logo
3
Most read
5
Most read
11
Most read
Polymorphism
By Nochiketa
Topics:
 1. What is Polymorphism?
 2. What is Polymorphism in OOP?
 3. How Polymorphism can be achieved?
 4. Types of Polymorphism
 5. Function Overloading
 6. Function Overriding
 7. Early Binding
 8. Late Binding and Virtual function
 9. Pure Virtual Function
What is Polymorphism?
 The process of representing one form in multiple form in known as
polymorphism . Typically, polymorphism occurs when there is a
hierarchy of classes and they are related by inheritance.
 It means that a call to a member function will cause a different
function to be executed depending on the type of object that
invokes the function.
What is Polymorphism in OOP?
 After the inheritance it is another most important feature
of OOP.
 In polymorphism, the member functions with same name are
define in base class and also in each derived class.
 Polymorphism is used to keep the interface of base class to
its derived classes.
 Polymorphism can be achieved by mean of virtual functions.
 In polymorphism one pointer to a base class object may also
point any object of its derived class.
How Polymorphism can be achieved:
 Polymorphism can be achieved in Three ways:
1. Function Overloading
2. Function Overriding
3. Dynamic Binding.
Types of Polymorphism:
Fig: Types of polymorphism
Polymorphism
Static Polymorphism :
Compile time/
static/Early Binding
Dynamic Polymorphism:
Runtime/Dynamic/Late
Binding
Types of Polymorphism:
 Static Polymorphism: It takes place during Compile
time. Function Overloading, Operator Overloading
implements static polymorphism.
 Dynamic Polymorphism: It takes place during Run
time. The member function whice change Their
behavior during run time called Virtual Functions.
Function Overloading
 Here we have multiple definitions for the same function name in the same scope. The
definition of the function must differ from each other by the types and/or the number of
arguments in the argument list.
Function Overriding
 Overriding of functions happens when one class inherits another class. Here functions of both
class have the same name and there world be same parameter list and return type of the
functions should be same.
Early Binding
 Events occurring at compile time are known as early binding. In the process of early binding
all info which is required for a function call is known at compile time. Examples of early
binding: function calls, overloaded function calls, and overloaded operators.
Late Binding and Virtual Function:
 All the Code is understood at the Time of Execution This is called as Late Binding. As we
Know that Late Binding is Performed By using the virtual Functions. Virtual Means Function
must be Override. Virtual Function is a function in base class, which is overrided in the
derived class, and which tells the compiler to perform Late Binding on this function.
Pure Virtual Function
 The virtual function that is only declare But Not Define In The In The
Base Class.
 General Syntax:
 virtual function_name()=0;
 The class that contains the pure virtual function exists only to act as
base or parent classes.
Polymorphism

More Related Content

PDF
Polymorphism in oop
PPT
Basic concept of OOP's
PPTX
Object Oriented Programming
PPTX
Inheritance in OOPS
PPTX
Encapsulation
PPTX
Polymorphism in c++(ppt)
PPTX
Polymorphism
PPTX
Fun Friday
Polymorphism in oop
Basic concept of OOP's
Object Oriented Programming
Inheritance in OOPS
Encapsulation
Polymorphism in c++(ppt)
Polymorphism
Fun Friday

What's hot (20)

PPT
Operator Overloading
PDF
Polymorphism
PPTX
Constructor and Types of Constructors
PPTX
Classes, objects in JAVA
PPTX
Functions in Python
PPTX
Inheritance in java
PPTX
Pure virtual function and abstract class
PPTX
Data types in python
PPTX
Oop c++class(final).ppt
PPTX
Abstract class in c++
PPTX
Inheritance in JAVA PPT
PDF
Polymorphism in Java
PPTX
Polymorphism and its types
PPTX
C# Inheritance
PPTX
Constructor ppt
PPTX
Python-Inheritance.pptx
PDF
Arrays in Java
PPTX
polymorphism
PPTX
Constructor in java
PPTX
Inheritance
Operator Overloading
Polymorphism
Constructor and Types of Constructors
Classes, objects in JAVA
Functions in Python
Inheritance in java
Pure virtual function and abstract class
Data types in python
Oop c++class(final).ppt
Abstract class in c++
Inheritance in JAVA PPT
Polymorphism in Java
Polymorphism and its types
C# Inheritance
Constructor ppt
Python-Inheritance.pptx
Arrays in Java
polymorphism
Constructor in java
Inheritance
Ad

Viewers also liked (20)

PPTX
Introduction to immunology
PPTX
PPT
Java Stack Traces
PDF
Linked list (java platform se 8 )
PPTX
Heap and stack space in java
PPTX
Java Stack (Pilha)
PDF
PPT
Techniques for enhancement of dissolution rate
PPT
Lymphocytes
PPTX
03 Java Language And OOP Part III
PPTX
acute inflammation
PPTX
01 introduction to oop and java
PPTX
Complexation study
PPTX
Java Collections Framework Inroduction with Video Tutorial
PPT
11,12
PPT
Acute inflammation by Dr Mohammad Manzoor Mashwani
PPT
Stack, queue and hashing
PDF
JAVA Object Oriented Programming (OOP)
PPTX
Arrays in java
PPTX
Lymphocytes
Introduction to immunology
Java Stack Traces
Linked list (java platform se 8 )
Heap and stack space in java
Java Stack (Pilha)
Techniques for enhancement of dissolution rate
Lymphocytes
03 Java Language And OOP Part III
acute inflammation
01 introduction to oop and java
Complexation study
Java Collections Framework Inroduction with Video Tutorial
11,12
Acute inflammation by Dr Mohammad Manzoor Mashwani
Stack, queue and hashing
JAVA Object Oriented Programming (OOP)
Arrays in java
Lymphocytes
Ad

Similar to Polymorphism (20)

PPTX
Polymorphism
PPTX
polymorphism OOP.pptx
PPTX
polymorphism and virtual function
PPTX
Oop lecture 06
PDF
polymorphism.pdf
PPTX
Polymorphism.Difference between Inheritance & Polymorphism
PPTX
Java Basics
PPTX
full defination of final opp.pptx
PPTX
OOPS & C++(UNIT 4)
PDF
Learn C# Programming Polymorphism & Operator Overloading
PPTX
OOP- PolymorphismFinal12injavait101.pptx
PPTX
Dynamic Polymorphism in C++
PPTX
What is java polymorphism and its types in java training?
PDF
Object oriented programming
PDF
Pocket java
PPTX
Polymorphism in C++
PDF
oopsinvb-191021101327.pdf
PPTX
Oops in vb
PPTX
Oopsecondgrouppresentation 180726073512-converted (1)
PPTX
Polymorphism
Polymorphism
polymorphism OOP.pptx
polymorphism and virtual function
Oop lecture 06
polymorphism.pdf
Polymorphism.Difference between Inheritance & Polymorphism
Java Basics
full defination of final opp.pptx
OOPS & C++(UNIT 4)
Learn C# Programming Polymorphism & Operator Overloading
OOP- PolymorphismFinal12injavait101.pptx
Dynamic Polymorphism in C++
What is java polymorphism and its types in java training?
Object oriented programming
Pocket java
Polymorphism in C++
oopsinvb-191021101327.pdf
Oops in vb
Oopsecondgrouppresentation 180726073512-converted (1)
Polymorphism

Recently uploaded (20)

PDF
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PPTX
communication and presentation skills 01
PPTX
introduction to high performance computing
PPT
introduction to datamining and warehousing
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
Information Storage and Retrieval Techniques Unit III
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Nature of X-rays, X- Ray Equipment, Fluoroscopy
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Artificial Intelligence
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
Soil Improvement Techniques Note - Rabbi
PPT
Total quality management ppt for engineering students
PPTX
Current and future trends in Computer Vision.pptx
PDF
III.4.1.2_The_Space_Environment.p pdffdf
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
communication and presentation skills 01
introduction to high performance computing
introduction to datamining and warehousing
Categorization of Factors Affecting Classification Algorithms Selection
Information Storage and Retrieval Techniques Unit III
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Nature of X-rays, X- Ray Equipment, Fluoroscopy
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
R24 SURVEYING LAB MANUAL for civil enggi
Artificial Intelligence
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
Soil Improvement Techniques Note - Rabbi
Total quality management ppt for engineering students
Current and future trends in Computer Vision.pptx
III.4.1.2_The_Space_Environment.p pdffdf

Polymorphism

  • 2. Topics:  1. What is Polymorphism?  2. What is Polymorphism in OOP?  3. How Polymorphism can be achieved?  4. Types of Polymorphism  5. Function Overloading  6. Function Overriding  7. Early Binding  8. Late Binding and Virtual function  9. Pure Virtual Function
  • 3. What is Polymorphism?  The process of representing one form in multiple form in known as polymorphism . Typically, polymorphism occurs when there is a hierarchy of classes and they are related by inheritance.  It means that a call to a member function will cause a different function to be executed depending on the type of object that invokes the function.
  • 4. What is Polymorphism in OOP?  After the inheritance it is another most important feature of OOP.  In polymorphism, the member functions with same name are define in base class and also in each derived class.  Polymorphism is used to keep the interface of base class to its derived classes.  Polymorphism can be achieved by mean of virtual functions.  In polymorphism one pointer to a base class object may also point any object of its derived class.
  • 5. How Polymorphism can be achieved:  Polymorphism can be achieved in Three ways: 1. Function Overloading 2. Function Overriding 3. Dynamic Binding.
  • 6. Types of Polymorphism: Fig: Types of polymorphism Polymorphism Static Polymorphism : Compile time/ static/Early Binding Dynamic Polymorphism: Runtime/Dynamic/Late Binding
  • 7. Types of Polymorphism:  Static Polymorphism: It takes place during Compile time. Function Overloading, Operator Overloading implements static polymorphism.  Dynamic Polymorphism: It takes place during Run time. The member function whice change Their behavior during run time called Virtual Functions.
  • 8. Function Overloading  Here we have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list.
  • 9. Function Overriding  Overriding of functions happens when one class inherits another class. Here functions of both class have the same name and there world be same parameter list and return type of the functions should be same.
  • 10. Early Binding  Events occurring at compile time are known as early binding. In the process of early binding all info which is required for a function call is known at compile time. Examples of early binding: function calls, overloaded function calls, and overloaded operators.
  • 11. Late Binding and Virtual Function:  All the Code is understood at the Time of Execution This is called as Late Binding. As we Know that Late Binding is Performed By using the virtual Functions. Virtual Means Function must be Override. Virtual Function is a function in base class, which is overrided in the derived class, and which tells the compiler to perform Late Binding on this function.
  • 12. Pure Virtual Function  The virtual function that is only declare But Not Define In The In The Base Class.  General Syntax:  virtual function_name()=0;  The class that contains the pure virtual function exists only to act as base or parent classes.