When using multiple inheritance, why is this qualified name ambiguous?
问题 I'm trying to access the member variable x in struct Top using a Bottom object. The code is the following: #include <cstdio> struct Top { public: int x = 1; }; struct Left : public Top { int x = 2; }; struct Right : public Top { int x = 3; }; struct Bottom : public Left, public Right { int x = 4; }; int main() { Bottom b; std::printf("value: %d\n", b.Left::Top::x); return 0; } This gives the following error using gcc 4.8: main.cpp: In function 'int main()': main.cpp:27:45: error: 'Top' is an