I have a simple structure and I want a pointer-to-member c. I'm using MSVC2012 and if I don't declare the struct abc as a type definition (typedef), I can't use it.. how come?
struct abc
{
int a;
int b;
char c;
};
char (struct abc)::*ptt1 = &(struct abc)::c; // Error: error C2144: syntax error : 'abc' should be preceded by ')'
typedef struct abc;
char abc::*ptt1 = &abc::c; // Compiles just fine
structis just likeclasskeyword (except the default member visibility), and you wouldn't write&(class abc)::c, would you? :)