Default
Google

Functions: Default Parameters

Applies To: C++Builder 1 or higher
Category: C++ Language

It is possible to call a function that uses arguments without specifying these arguments. In this case, the function must contain default values:
 
void calculate(int x = 10, int y = 20)
{
}
 
If you call calculate(~);, then the function will use by default the values 10 and 20. It is also possible to specify only one of the arguments: calculate(25); will set the value of x to 25 and the value of y to 20.

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange