SlideShare a Scribd company logo
1 of 13
Polymorphism
By Sir Najam
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 OOP.pptx

More Related Content

Similar to polymorphism OOP.pptx

Polymorphism in C++
Polymorphism in C++Polymorphism in C++
Polymorphism in C++Rabin BK
 
Inheritance, friend function, virtual function, polymorphism
Inheritance, friend function, virtual function, polymorphismInheritance, friend function, virtual function, polymorphism
Inheritance, friend function, virtual function, polymorphismJawad Khan
 
Oopsecondgrouppresentation 180726073512-converted (1)
Oopsecondgrouppresentation 180726073512-converted (1)Oopsecondgrouppresentation 180726073512-converted (1)
Oopsecondgrouppresentation 180726073512-converted (1)Hassan Hashmi
 
Virtual function complete By Abdul Wahab (moon sheikh)
Virtual function complete By Abdul Wahab (moon sheikh)Virtual function complete By Abdul Wahab (moon sheikh)
Virtual function complete By Abdul Wahab (moon sheikh)MoonSheikh1
 
Virtual function
Virtual functionVirtual function
Virtual functionzindadili
 
Learn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator OverloadingLearn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator OverloadingEng Teong Cheah
 
Polymorphism Using C++
Polymorphism Using C++Polymorphism Using C++
Polymorphism Using C++PRINCE KUMAR
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2Rakesh Madugula
 
Inheritance and Polymorphism
Inheritance and PolymorphismInheritance and Polymorphism
Inheritance and PolymorphismKartikKapgate
 
Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsRaja Sekhar
 
Polymorphism
PolymorphismPolymorphism
PolymorphismAmir Ali
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.Questpond
 

Similar to polymorphism OOP.pptx (20)

Oop lecture 06
Oop lecture 06Oop lecture 06
Oop lecture 06
 
Polymorphism in C++
Polymorphism in C++Polymorphism in C++
Polymorphism in C++
 
Inheritance, friend function, virtual function, polymorphism
Inheritance, friend function, virtual function, polymorphismInheritance, friend function, virtual function, polymorphism
Inheritance, friend function, virtual function, polymorphism
 
Oopsecondgrouppresentation 180726073512-converted (1)
Oopsecondgrouppresentation 180726073512-converted (1)Oopsecondgrouppresentation 180726073512-converted (1)
Oopsecondgrouppresentation 180726073512-converted (1)
 
Virtual Function
Virtual FunctionVirtual Function
Virtual Function
 
Virtual function complete By Abdul Wahab (moon sheikh)
Virtual function complete By Abdul Wahab (moon sheikh)Virtual function complete By Abdul Wahab (moon sheikh)
Virtual function complete By Abdul Wahab (moon sheikh)
 
Virtual function
Virtual functionVirtual function
Virtual function
 
Learn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator OverloadingLearn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator Overloading
 
Polymorphism Using C++
Polymorphism Using C++Polymorphism Using C++
Polymorphism Using C++
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
Inheritance and Polymorphism
Inheritance and PolymorphismInheritance and Polymorphism
Inheritance and Polymorphism
 
polymorphism ppt
polymorphism pptpolymorphism ppt
polymorphism ppt
 
OOPS & C++(UNIT 4)
OOPS & C++(UNIT 4)OOPS & C++(UNIT 4)
OOPS & C++(UNIT 4)
 
Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwords
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Opps
OppsOpps
Opps
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Virtual Functions
Virtual FunctionsVirtual Functions
Virtual Functions
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 

More from AssadLeo1

half day batch male hafizabad list of pos and apos
half day batch male hafizabad list of pos and aposhalf day batch male hafizabad list of pos and apos
half day batch male hafizabad list of pos and aposAssadLeo1
 
Database management book slides.ppt
Database management book slides.pptDatabase management book slides.ppt
Database management book slides.pptAssadLeo1
 
MS Excel Detailed into.pptx
MS Excel Detailed into.pptxMS Excel Detailed into.pptx
MS Excel Detailed into.pptxAssadLeo1
 
INput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxINput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxAssadLeo1
 
Polymorphism OOP Old Gate.pptx
Polymorphism OOP Old Gate.pptxPolymorphism OOP Old Gate.pptx
Polymorphism OOP Old Gate.pptxAssadLeo1
 
MS Excel Detailed intorduction.pptx
MS Excel Detailed intorduction.pptxMS Excel Detailed intorduction.pptx
MS Excel Detailed intorduction.pptxAssadLeo1
 
network-management Web base.ppt
network-management Web base.pptnetwork-management Web base.ppt
network-management Web base.pptAssadLeo1
 
Polymorphism OOP new Gate.pptx
Polymorphism OOP new Gate.pptxPolymorphism OOP new Gate.pptx
Polymorphism OOP new Gate.pptxAssadLeo1
 
MS Excel Lite Introduction.ppt
MS Excel Lite Introduction.pptMS Excel Lite Introduction.ppt
MS Excel Lite Introduction.pptAssadLeo1
 
Monitoring sytem.ppt
Monitoring sytem.pptMonitoring sytem.ppt
Monitoring sytem.pptAssadLeo1
 

More from AssadLeo1 (10)

half day batch male hafizabad list of pos and apos
half day batch male hafizabad list of pos and aposhalf day batch male hafizabad list of pos and apos
half day batch male hafizabad list of pos and apos
 
Database management book slides.ppt
Database management book slides.pptDatabase management book slides.ppt
Database management book slides.ppt
 
MS Excel Detailed into.pptx
MS Excel Detailed into.pptxMS Excel Detailed into.pptx
MS Excel Detailed into.pptx
 
INput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxINput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptx
 
Polymorphism OOP Old Gate.pptx
Polymorphism OOP Old Gate.pptxPolymorphism OOP Old Gate.pptx
Polymorphism OOP Old Gate.pptx
 
MS Excel Detailed intorduction.pptx
MS Excel Detailed intorduction.pptxMS Excel Detailed intorduction.pptx
MS Excel Detailed intorduction.pptx
 
network-management Web base.ppt
network-management Web base.pptnetwork-management Web base.ppt
network-management Web base.ppt
 
Polymorphism OOP new Gate.pptx
Polymorphism OOP new Gate.pptxPolymorphism OOP new Gate.pptx
Polymorphism OOP new Gate.pptx
 
MS Excel Lite Introduction.ppt
MS Excel Lite Introduction.pptMS Excel Lite Introduction.ppt
MS Excel Lite Introduction.ppt
 
Monitoring sytem.ppt
Monitoring sytem.pptMonitoring sytem.ppt
Monitoring sytem.ppt
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 

polymorphism OOP.pptx

  • 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.