Functions: Overloading
Applies To: C++Builder 1 or higher
Category: C++ Language
- More than one function can have the same name. In this case, the compiler chooses one of the overloaded functions according to the number and type of arguments. For example, if you have the following two functions:
-
- void calculate(int x, int y)
- {
- }
-
- void calculate(int x, int y, int z)
- {
- }
-
- and you execute calculate(10, 10); the first overloaded function will be called. If you execute however calculate(10, 10, 10);, then the compiler will choose the second overloaded function.
C++Builder Developer's Network
Copyright © Yoto Yotov