[dcl.mptr] (original) (raw)
:
struct X { void f(int); int a; }; struct Y;
int X::* pmi = &X::a; void (X::* pmf)(int) = &X::f; double X::* pmd; char Y::* pmc;
declarespmi,pmf,pmdandpmcto be a pointer to a member ofXof typeint, a pointer to a member ofXof typevoid(int), a pointer to a member ofXof typedoubleand a pointer to a member ofYof typecharrespectively.
The declaration ofpmdis well-formed even thoughXhas no members of typedouble.
Similarly, the declaration ofpmcis well-formed even thoughYis an incomplete type.
pmiandpmfcan be used like this:
X obj;
obj.*pmi = 7;
(obj.*pmf)(7);
— end example