- In C ++, when defining the function can specify a parameter to the default value, so that the function is called without parameter to the assignment (no corresponding argument), the argument is equal to the default value
- Defaults should be on the end of the parameter list, and once for a shape parameter specifies the default value, then behind it all parameter must have a default value
- With the default parameters, function calls can take many forms
- In the design of the class, by using default parameters, reducing the number of overloaded destructor method and the method to be defined
- The default parameters can be specified in the declaration or definition of the function
- When you specify the default parameters in the declaration to pay attention at, C ++ provides: a parameter in the specified scope can only be given once the default parameters. The compiler will automatically use the default parameters of the current scope
C ++ - default parameters
Guess you like
Origin www.cnblogs.com/cxc1357/p/11908353.html
Recommended
Ranking