问题
It tried something like this, which doesn't work. Is there a way to get a similar effect?
class A
{
public:
int foo();
void bar(int b = foo());
};
回答1:
Yes. Overload the function and call the member-function in it.
void bar() { bar(foo()); }
来源:https://stackoverflow.com/questions/4901233/is-there-anyway-to-use-a-member-function-as-a-default-parameter