C++ FunctionsLesson 27Free preview
C++ Function Overloading
This lesson is part of C++ · All levels
Summary
This lesson discusses overloading, which is the ability to define several functions with the same name but different lists of parameters. The compiler will select the most appropriate function based on the number and type of arguments when calling. This technique makes the API more concise because a single name can serve multiple data types.
Key points
- Overloading is based on the difference in number or type of parameters.
- The difference only in the type is not enough for overloading.
- The compiler selects the version of the function based on the arguments called.
- Overloading makes it easy to write similar functions for different data types.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.