struct A {
void foo(int) { printf("this is the wrong function\n"; }
void foo() { printf("this is the right function\n"; }
}
int main() {
auto method = &A::foo; // c++ why don't you me allow to give argument types?
A a;
(a.*method)()
}
I know this little example works fine with just replacing auto with an explicit type, but that is not, what I am looking for. I would like to tell c++ on the right side of the equals, which method I want.
Aucun commentaire:
Enregistrer un commentaire