发信人: careerchange (Stupid), 信区: Programming

标 题: C++ Q16: dereferencing

发信站: BBS 未名空间站 (Mon Aug 9 22:49:44 2010, 美东)


struct X {

int foo() { return 0; }

} x;


struct Y { static int (X::*p)(); };


int (X::*Y::p)()=&X::foo;


Given the declarations in the sample code above, which one of the following

invocations is correct?

a) (x.*Y::p)();

b) (x->*Y::p)();

c) (Y::p)(x);

d) (Y::x.*p)();

e) (x.Y::p)();