Question

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());
};
Was it helpful?

Solution

Yes. Overload the function and call the member-function in it.

void bar() { bar(foo()); }

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top