In the thread "Making a argument optional to function", it is stated that to set default values for arguments of a function you can simply do so in the function definition, like:
int myfunc(int a, int b, int c=3) {...}
This then automatically puts c to 3 in the function body if a call like myfunc(1,2); is made, if I understood correctly. However, this does not seem to hold for class functions. For example, something like:
1 2 3 4 5 6
class classy {
public:
int class_func(int, int, int); // class function prototype
}
int classy::class_func(int a, int b, int c=3) {...}
fails to compile. What I would like is to be able to call class_func outside of this class (by including it as a header in another macro), optionally specifying c. If c is not specified in the call, it should use a default value.