SlideShare a Scribd company logo
4
Most read
Function Overloading
Yogendra Pal
At the end of this tutorial you will be able to
• Explain function signature.
• Differentiate functions on the basis of their signature.
• Explain function overloading.
• Identify overloaded functions from a given c++ program.
• Identify which function will execute on a call to overloaded function.
• Identify an ambiguous function call.
• Write overloaded functions in a c++ program.
www.learnbywatch.com | yogendra@learnbywatch.com
Function Overloading / Function Polymorphism
• Polymorphism (बहुरूपता) means having many forms.
• Function polymorphism: A function in many forms.
• The process of creating same named functions is called function overloading.
• Such functions are called overloaded functions.
• In C++ two functions can have same name as long as their signatures are
different.
www.learnbywatch.com | yogendra@learnbywatch.com
Function Signature / Argument List
• Argument list of a function defines it’s signature.
• Signature of a function is different if any one of the following is different.
• Number of arguments,
• Data Type of arguments and
• Order of arguments.
www.learnbywatch.com | yogendra@learnbywatch.com
void setTime( ); void setTime(int hh); void setTime(int hh, double mm);
void setTime(double hh); void setTime(double mm, int hh);
Call an overloaded function
• void setTime( );
• void setTime(int hh);
• void setTime(int hh, double mm);
• void setTime(double hh);
• void setTime(double mm, int hh);
• setTime(12.5)
• setTime(12.5 , 7)
• setTime()
• setTime(7, 12.5)
• setTime(7)
www.learnbywatch.com | yogendra@learnbywatch.com
Ambiguous Call
• void setTime(int hh, double mm);
• void setTime(double mm, int hh);
• setTime(5, 1.2)
• setTime(4.2, 5)
• setTime(2, 3)
• setTime(2.1, 4.5)
www.learnbywatch.com | yogendra@learnbywatch.com
Ask your questions
to learn better
Yogendra Pal
www.learnbywatch.com | yogendra@learnbywatch.com

More Related Content

PPT
3 Function Overloading
PPTX
Function overloading and overriding
PPTX
Function overloading
PPTX
INLINE FUNCTION IN C++
PPTX
Inline function
PPTX
Inline Functions and Default arguments
PPTX
Inline function in C++
PPTX
Function different types of funtion
3 Function Overloading
Function overloading and overriding
Function overloading
INLINE FUNCTION IN C++
Inline function
Inline Functions and Default arguments
Inline function in C++
Function different types of funtion

What's hot (20)

PPTX
Inline function in C++
PPTX
PPTX
Functions in C++ (OOP)
PDF
Client sidescripting javascript
PPT
Functions in C++
PPT
Functions in c++
PPT
Functions in C++
PPT
Functions in C++
PPTX
Inline functions & macros
PDF
Functional JavaScript Fundamentals
DOCX
Inline function(oops)
PPTX
Inline functions
PPT
16717 functions in C++
 
PPT
16 virtual function
PPTX
Function class in c++
ODP
C++ Function
PPTX
virtual function
PPTX
Operator overloadng
PPT
Functions in c++
PPTX
Operator overloading
Inline function in C++
Functions in C++ (OOP)
Client sidescripting javascript
Functions in C++
Functions in c++
Functions in C++
Functions in C++
Inline functions & macros
Functional JavaScript Fundamentals
Inline function(oops)
Inline functions
16717 functions in C++
 
16 virtual function
Function class in c++
C++ Function
virtual function
Operator overloadng
Functions in c++
Operator overloading
Ad

Viewers also liked (20)

PPTX
Function overloading
PPTX
Function overloading
PPT
Function Overlaoding
PPTX
Presentation on overloading
PDF
03 function overloading
PPTX
Operator overloading
PPT
Object Oriented Programming Concepts
PPTX
2CPP08 - Overloading and Overriding
PPTX
functions of C++
PPT
Function overloading(c++)
PPTX
encapsulation, inheritance, overriding, overloading
PPTX
Introduction to Java
PPTX
operator overloading in c++
PDF
Introduction to cpp
PPT
C++ overloading
PPT
098ca session7 c++
PPTX
Intro To C++ - Class 14 - Midterm Review
PPT
Fp201 unit2 1
PDF
C++ Object oriented concepts & programming
Function overloading
Function overloading
Function Overlaoding
Presentation on overloading
03 function overloading
Operator overloading
Object Oriented Programming Concepts
2CPP08 - Overloading and Overriding
functions of C++
Function overloading(c++)
encapsulation, inheritance, overriding, overloading
Introduction to Java
operator overloading in c++
Introduction to cpp
C++ overloading
098ca session7 c++
Intro To C++ - Class 14 - Midterm Review
Fp201 unit2 1
C++ Object oriented concepts & programming
Ad

Similar to Function overloading in c++ (20)

PPTX
Polymorphism and its types
PPTX
Presentation on polymorphism in c++.pptx
PPT
Polymorphism
PPTX
11.C++Polymorphism [Autosaved].pptx
PPT
OODP UNIT 2 Function overloading
PPTX
Polymorphism
PDF
OOP_UnitIII.pdf
PPTX
polymorphism and virtual function
PDF
Comparison between runtime polymorphism and compile time polymorphism
PPTX
Functions and modular programming.pptx
PPTX
Chapter One Function.pptx
PPTX
Polymorphism 140527082302-phpapp01
PPTX
C++ first s lide
PPTX
FUNCTIONengineeringtechnologyslidesh.pptx
PPTX
FUNCTION.pptxfkrdutytrtttrrtttttttttttttt
PPTX
functions in the c programming and the examples
PPTX
Polymorphism
PPTX
OOPS & C++(UNIT 4)
PDF
Learn C# Programming Polymorphism & Operator Overloading
PPTX
full defination of final opp.pptx
Polymorphism and its types
Presentation on polymorphism in c++.pptx
Polymorphism
11.C++Polymorphism [Autosaved].pptx
OODP UNIT 2 Function overloading
Polymorphism
OOP_UnitIII.pdf
polymorphism and virtual function
Comparison between runtime polymorphism and compile time polymorphism
Functions and modular programming.pptx
Chapter One Function.pptx
Polymorphism 140527082302-phpapp01
C++ first s lide
FUNCTIONengineeringtechnologyslidesh.pptx
FUNCTION.pptxfkrdutytrtttrrtttttttttttttt
functions in the c programming and the examples
Polymorphism
OOPS & C++(UNIT 4)
Learn C# Programming Polymorphism & Operator Overloading
full defination of final opp.pptx

More from Learn By Watch (20)

PPTX
Tutorial 9 fm
PPTX
Phase modulation
PPTX
Demodulation of fm pll detector
PPTX
Demodulation of fm slope and balanced slope detector
PPTX
In direct method of fm generation armstrong method
PPTX
Direct method of fm generation hartley oscillator method
PPTX
Carson's rule
PPTX
Spectrum and power of wbfm
PPTX
Narrow band frequency modulation nbfm
PPTX
General expression of fm signal
PPTX
Angle modulation
PPTX
Frequency division multiplexing
PPTX
Vsb modulation
PPTX
Demodulation of ssb synchronous detector
PPTX
Generarion of ssb phase discrimination method
PPTX
Generarion of ssb frequency discrimination method
PPTX
Ssb modulation
PPTX
Demodulation of dsb sc costas receiver
PPTX
Quadrature carrier multiplexing qam
PPTX
Demodulation of am synchronous detector
Tutorial 9 fm
Phase modulation
Demodulation of fm pll detector
Demodulation of fm slope and balanced slope detector
In direct method of fm generation armstrong method
Direct method of fm generation hartley oscillator method
Carson's rule
Spectrum and power of wbfm
Narrow band frequency modulation nbfm
General expression of fm signal
Angle modulation
Frequency division multiplexing
Vsb modulation
Demodulation of ssb synchronous detector
Generarion of ssb phase discrimination method
Generarion of ssb frequency discrimination method
Ssb modulation
Demodulation of dsb sc costas receiver
Quadrature carrier multiplexing qam
Demodulation of am synchronous detector

Recently uploaded (20)

PPTX
Pharma ospi slides which help in ospi learning
PDF
Classroom Observation Tools for Teachers
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
Trump Administration's workforce development strategy
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Lesson notes of climatology university.
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Cell Types and Its function , kingdom of life
Pharma ospi slides which help in ospi learning
Classroom Observation Tools for Teachers
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Yogi Goddess Pres Conference Studio Updates
O7-L3 Supply Chain Operations - ICLT Program
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Chinmaya Tiranga quiz Grand Finale.pdf
Trump Administration's workforce development strategy
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Orientation - ARALprogram of Deped to the Parents.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Lesson notes of climatology university.
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Anesthesia in Laparoscopic Surgery in India
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Cell Types and Its function , kingdom of life

Function overloading in c++

  • 2. At the end of this tutorial you will be able to • Explain function signature. • Differentiate functions on the basis of their signature. • Explain function overloading. • Identify overloaded functions from a given c++ program. • Identify which function will execute on a call to overloaded function. • Identify an ambiguous function call. • Write overloaded functions in a c++ program. www.learnbywatch.com | [email protected]
  • 3. Function Overloading / Function Polymorphism • Polymorphism (बहुरूपता) means having many forms. • Function polymorphism: A function in many forms. • The process of creating same named functions is called function overloading. • Such functions are called overloaded functions. • In C++ two functions can have same name as long as their signatures are different. www.learnbywatch.com | [email protected]
  • 4. Function Signature / Argument List • Argument list of a function defines it’s signature. • Signature of a function is different if any one of the following is different. • Number of arguments, • Data Type of arguments and • Order of arguments. www.learnbywatch.com | [email protected] void setTime( ); void setTime(int hh); void setTime(int hh, double mm); void setTime(double hh); void setTime(double mm, int hh);
  • 5. Call an overloaded function • void setTime( ); • void setTime(int hh); • void setTime(int hh, double mm); • void setTime(double hh); • void setTime(double mm, int hh); • setTime(12.5) • setTime(12.5 , 7) • setTime() • setTime(7, 12.5) • setTime(7) www.learnbywatch.com | [email protected]
  • 6. Ambiguous Call • void setTime(int hh, double mm); • void setTime(double mm, int hh); • setTime(5, 1.2) • setTime(4.2, 5) • setTime(2, 3) • setTime(2.1, 4.5) www.learnbywatch.com | [email protected]
  • 7. Ask your questions to learn better Yogendra Pal www.learnbywatch.com | [email protected]