[Solved] VS2017 “non-standard syntax; use ‘&’ to create a pointer to member ” [closed]


On the line

cout << "BySimpson:" << MyInt.BySimpson << endl << endl;

You probably meant to make a call to BySimpson but your forgot the ()

cout << "BySimpson:" << MyInt.BySimpson() << endl << endl;

The reason you get this misleading error is because pre ISO standarization MyInt.BySimpson would actually mean you wanted the address just like for normal function the function name on its own gives the address of the function. Later however the use of & to take the address of a member was put in the standard as a requirement. So Visual Studio thinks you are still using the old syntax and wants you to use the new syntax.

3

solved VS2017 “non-standard syntax; use ‘&’ to create a pointer to member ” [closed]