class C {
private:
int n{ 5 };
public:
int return5() { return 5; }
void f(int d = return5()) {
}
void ff(int d = n) {
}
};
Why I can't initialize the functions default parameters with member class? I get an error: a nonstatic member reference must be relative to a specific object.
I think the problem because no object has been instantiated yet, but is there any approach to do it?