SlideShare a Scribd company logo
1 of 15
Download to read offline
BABA GHULAM SHAH BADSHAH
UNIVERSITY- RAJOURI (J&K).
DEPARTMENT OF COMPUTER
SCIENCES
PRESENTATION TOPIC:-
PRESENTED BY:-
Ajeela Mushtaq Roll NO:-13-Mcs-15
PRESENTED TO:-
Mr. QAMAR RAYEES
KHAN
POLYMORPHISM.
INDEX
Types of polymorphism.
▷ Static polymorphism
▷ Dynamic polymorphism
▷The word polymorphism means having
many forms.
▷Polymorphism occurs when there is a
hierarchy of classes and they are
related by inheritance.
Polymorphism
▷ Polymorphism is an object-oriented
programming concept that refers to the
ability of a variable, function or object to
take on multiple forms.
▷ A language that features polymorphism
allows developers to program in the
general rather than program in the
specific.Polymorphism
▷ means the ability to take more than one
form.
▷ Static polymorphism refers to an entity
existing in different physical forms
simultaneously.
▷ It involves of binding of function based
on the number, type and sequence of
arguments.
▷ The various types of parameters are
specified in the function can be bound to
call at compile time.
▷ Early binding.
▷ When the program is executed, the calls
are already bound to the appropriate
functions.
▷ The resolution of a function call is based
on number, type and sequence of
arguments declaration for each form of
the function.
// function declaration
void add()
void add(int , int);
void add(float, float);
When the add() function is invoked, the
parameters passed to it will determine
which version is done at compile time.
▷ If any class have multiple function
with same name but different
parameters then they are said to be
overloaded.
▷ Function overloading allows you to
use the same name for different
functions, to perform , either same or
different functions in the same class.
▷ It is usually used to enhance the
readability of the program.
Example
#include<iostream.h>
Class abc
{
int a;
int b;
}
assign(int x)
{
a=x;
b=x;
}
assign(int x, int y)
{
a=x;
b=y;
}
};
Void main()
{
ob abc obj
obj.assign(10)
obj.assign(20,30)
getch()
}
▷ Operator overloading is an important
concept in C++. It is a type of
polymorphism in which an operator is
overloaded to give user defined meaning
to it.
▷ Overloaded operator is used to perform
operation on user-defined data type.
▷ For example '+' operator can be
overloaded to perform addition on various
data types, like for Integer,
String(concatenation) etc.
▷ Almost any operator can be
overloaded in C++. However there are
few operator which can not be
overloaded.Operator that are not
overloaded are follows
▷ scope operator - ::
▷ sizeof
▷ member selector - .
▷ member pointer selector - *
▷ ternary operator - ?:
Run Time Polymorphism:
▷ C++ allows binding to be delayed till run
time. When you have a function with same
name, equal number of arguments and
same data type in same sequence in base
class as well derived class and a function
call of form:
base_class_type_ptr-
>member_function(args);
will always call base class member function.
▷ The keyword virtual on a member function
in base class indicates to the compiler to
delay the binding till run time..
▷ Every class with at least one virtual
function has a table that helps in
binding at run time. Looking at the
content of base class type pointer it
will correctly call the member function
of one of possible derived / base
class member function

More Related Content

What's hot

Lecture 3 getting_started_with__c_
Lecture 3 getting_started_with__c_Lecture 3 getting_started_with__c_
Lecture 3 getting_started_with__c_eShikshak
 
Encapsulation in C++
Encapsulation in C++Encapsulation in C++
Encapsulation in C++Hitesh Kumar
 
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-IssueCodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-IssueDhaval Dalal
 
Php training in chandigarh
Php training in chandigarhPhp training in chandigarh
Php training in chandigarhSheetal Sharma
 
Dublin Core Description Set Profiles
Dublin Core Description Set ProfilesDublin Core Description Set Profiles
Dublin Core Description Set ProfilesPete Johnston
 
Exposing relational database as rdf
Exposing relational database as rdfExposing relational database as rdf
Exposing relational database as rdfShakil Ahmed
 
Grammatical Framework for implementing multilingual frames and constructions
Grammatical Framework for implementing multilingual frames and constructionsGrammatical Framework for implementing multilingual frames and constructions
Grammatical Framework for implementing multilingual frames and constructionsNormunds Grūzītis
 
C++
C++C++
C++k v
 
When to use a structure vs classes in c++
When to use a structure vs classes in c++When to use a structure vs classes in c++
When to use a structure vs classes in c++Naman Kumar
 
Bc0053 – vb.net & xml
Bc0053 – vb.net & xmlBc0053 – vb.net & xml
Bc0053 – vb.net & xmlsmumbahelp
 

What's hot (20)

Lecture 3 getting_started_with__c_
Lecture 3 getting_started_with__c_Lecture 3 getting_started_with__c_
Lecture 3 getting_started_with__c_
 
Smali语法
Smali语法Smali语法
Smali语法
 
C programming unit 01
C programming unit 01C programming unit 01
C programming unit 01
 
Lesson1
Lesson1Lesson1
Lesson1
 
Encapsulation in C++
Encapsulation in C++Encapsulation in C++
Encapsulation in C++
 
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-IssueCodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
CodeJugalbandi-Expression-Problem-HealthyCode-Magazine#Jan-2015-Issue
 
Php training in chandigarh
Php training in chandigarhPhp training in chandigarh
Php training in chandigarh
 
Dublin Core Description Set Profiles
Dublin Core Description Set ProfilesDublin Core Description Set Profiles
Dublin Core Description Set Profiles
 
Exposing relational database as rdf
Exposing relational database as rdfExposing relational database as rdf
Exposing relational database as rdf
 
Grammatical Framework for implementing multilingual frames and constructions
Grammatical Framework for implementing multilingual frames and constructionsGrammatical Framework for implementing multilingual frames and constructions
Grammatical Framework for implementing multilingual frames and constructions
 
Cfg part i
Cfg   part iCfg   part i
Cfg part i
 
Subtyping
SubtypingSubtyping
Subtyping
 
Structure in C
Structure in CStructure in C
Structure in C
 
Chapter 03
Chapter 03Chapter 03
Chapter 03
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
C++
C++C++
C++
 
Week1
Week1Week1
Week1
 
Functional Concepts
Functional ConceptsFunctional Concepts
Functional Concepts
 
When to use a structure vs classes in c++
When to use a structure vs classes in c++When to use a structure vs classes in c++
When to use a structure vs classes in c++
 
Bc0053 – vb.net & xml
Bc0053 – vb.net & xmlBc0053 – vb.net & xml
Bc0053 – vb.net & xml
 

Similar to Polymorphism

Similar to Polymorphism (20)

C++ first s lide
C++ first s lideC++ first s lide
C++ first s lide
 
Polymorphism and its types
Polymorphism and its typesPolymorphism and its types
Polymorphism and its types
 
oops.pptx
oops.pptxoops.pptx
oops.pptx
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Presentation on polymorphism in c++.pptx
Presentation on polymorphism in c++.pptxPresentation on polymorphism in c++.pptx
Presentation on polymorphism in c++.pptx
 
SEMINAR
SEMINARSEMINAR
SEMINAR
 
Seminar
SeminarSeminar
Seminar
 
Oop concepts
Oop conceptsOop concepts
Oop concepts
 
Promoting Polymorphism
Promoting PolymorphismPromoting Polymorphism
Promoting Polymorphism
 
c++session 1.pptx
c++session 1.pptxc++session 1.pptx
c++session 1.pptx
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Function oveloading
Function oveloadingFunction oveloading
Function oveloading
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)
 
Ch-3.pdf
Ch-3.pdfCh-3.pdf
Ch-3.pdf
 
OOP_UnitIII.pdf
OOP_UnitIII.pdfOOP_UnitIII.pdf
OOP_UnitIII.pdf
 
Learn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator OverloadingLearn C# Programming Polymorphism & Operator Overloading
Learn C# Programming Polymorphism & Operator Overloading
 
Polymorphism & Templates
Polymorphism & TemplatesPolymorphism & Templates
Polymorphism & Templates
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
Polymorphism in Java by Animesh Sarkar
Polymorphism in Java by Animesh SarkarPolymorphism in Java by Animesh Sarkar
Polymorphism in Java by Animesh Sarkar
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
 

More from ajeela mushtaq (12)

String.ppt
String.pptString.ppt
String.ppt
 
Sets automata
Sets automataSets automata
Sets automata
 
Mail merge
Mail mergeMail merge
Mail merge
 
Linux hotspot
Linux hotspotLinux hotspot
Linux hotspot
 
Interfaces .net
Interfaces .netInterfaces .net
Interfaces .net
 
Incremental
IncrementalIncremental
Incremental
 
Gprs
GprsGprs
Gprs
 
Graphics a buffer
Graphics a bufferGraphics a buffer
Graphics a buffer
 
Disk allocation methods
Disk allocation methodsDisk allocation methods
Disk allocation methods
 
Data com prsntation
Data com prsntationData com prsntation
Data com prsntation
 
Avl tree
Avl treeAvl tree
Avl tree
 
Dynamic routing
Dynamic routingDynamic routing
Dynamic routing
 

Recently uploaded

Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 

Recently uploaded (20)

Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 

Polymorphism

  • 1. BABA GHULAM SHAH BADSHAH UNIVERSITY- RAJOURI (J&K). DEPARTMENT OF COMPUTER SCIENCES PRESENTATION TOPIC:- PRESENTED BY:- Ajeela Mushtaq Roll NO:-13-Mcs-15 PRESENTED TO:- Mr. QAMAR RAYEES KHAN POLYMORPHISM.
  • 2. INDEX Types of polymorphism. ▷ Static polymorphism ▷ Dynamic polymorphism
  • 3. ▷The word polymorphism means having many forms. ▷Polymorphism occurs when there is a hierarchy of classes and they are related by inheritance.
  • 4. Polymorphism ▷ Polymorphism is an object-oriented programming concept that refers to the ability of a variable, function or object to take on multiple forms. ▷ A language that features polymorphism allows developers to program in the general rather than program in the specific.Polymorphism ▷ means the ability to take more than one form.
  • 5.
  • 6. ▷ Static polymorphism refers to an entity existing in different physical forms simultaneously. ▷ It involves of binding of function based on the number, type and sequence of arguments. ▷ The various types of parameters are specified in the function can be bound to call at compile time.
  • 7. ▷ Early binding. ▷ When the program is executed, the calls are already bound to the appropriate functions. ▷ The resolution of a function call is based on number, type and sequence of arguments declaration for each form of the function.
  • 8. // function declaration void add() void add(int , int); void add(float, float); When the add() function is invoked, the parameters passed to it will determine which version is done at compile time.
  • 9. ▷ If any class have multiple function with same name but different parameters then they are said to be overloaded. ▷ Function overloading allows you to use the same name for different functions, to perform , either same or different functions in the same class. ▷ It is usually used to enhance the readability of the program.
  • 10. Example #include<iostream.h> Class abc { int a; int b; } assign(int x) { a=x; b=x; } assign(int x, int y) { a=x; b=y; } };
  • 11. Void main() { ob abc obj obj.assign(10) obj.assign(20,30) getch() }
  • 12. ▷ Operator overloading is an important concept in C++. It is a type of polymorphism in which an operator is overloaded to give user defined meaning to it. ▷ Overloaded operator is used to perform operation on user-defined data type. ▷ For example '+' operator can be overloaded to perform addition on various data types, like for Integer, String(concatenation) etc.
  • 13. ▷ Almost any operator can be overloaded in C++. However there are few operator which can not be overloaded.Operator that are not overloaded are follows ▷ scope operator - :: ▷ sizeof ▷ member selector - . ▷ member pointer selector - * ▷ ternary operator - ?:
  • 14. Run Time Polymorphism: ▷ C++ allows binding to be delayed till run time. When you have a function with same name, equal number of arguments and same data type in same sequence in base class as well derived class and a function call of form: base_class_type_ptr- >member_function(args); will always call base class member function. ▷ The keyword virtual on a member function in base class indicates to the compiler to delay the binding till run time..
  • 15. ▷ Every class with at least one virtual function has a table that helps in binding at run time. Looking at the content of base class type pointer it will correctly call the member function of one of possible derived / base class member function