C++ 允许函数指针 and 函数参考 https://stackoverflow.com/questions/480248/function-references。它还允许指向成员函数的指针.
But 是否允许引用成员函数?
我似乎无法从标准中推断出规则,而且我也未能使程序与它们一起工作。
[ member function pointers http://www.ideone.com/C6oex ] [ member function references http://www.ideone.com/D9tUI ]
[C++11: 8.3.3/3]:
A pointer to member shall not point to a static
member of a class (9.4), a member with reference type, or “cv void.” [
Note: See also 5.3 and 5.5. The type “pointer to member” is distinct
from the type “pointer”, that is, a pointer to member is declared only
by the pointer to member declarator syntax, and never by the pointer
declarator syntax. There is no “reference-to-member” type in C++. —end
note ]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)