答案 0 :(得分:6)
y
是指向*x
类型内的成员类型的指针,请参阅下面的示例。
struct Obj { int m; };
...
Obj o;
Obj * p = &o;
int Obj::* y = &Obj::m;
// 'y' can point to any int inside Obj, currently it's pointing at Obj::m
// do notice that it's not bound to any specific instance of Obj
o.m = 10;
std::cout << (p->* y) << std::endl;
std::cout << (o .* y) << std::endl;
输出
10
10
答案 1 :(得分:5)
别的。请参阅此处的C ++ FAQ:
http://www.parashift.com/c++-faq-lite/pointers-to-members.html