Please, how can I have this kind of logics?
class SomeClass
public:
SomeClass ;
void (*modifier)(int&) {m1};
private:
void m1(int& i) {i++;}
void m2(int& i) {i--;}
void changer (bool condition) {
if(condition) {
modifier=m1;
} else {
modifier=m2;
}
}
when I try to compile such code, I get
error: cannot convert 'SomeClass::m1' from type 'void (SomeClass::)(int&)' to type 'void (SomeClass::*)(int&)'
New contributor
Copych is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1