This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [C++] Overloading a type name with a function


> From what I can tell the definition of 'class A' is completely hidden
> in C by 'bool B::A(int)'.  Thus a syntax error in the declaration of
> myA.  Is this right, or should the compiler find the class A
> declaration in the top level?

This is right; the method shadows the class. To correct this, you can
either write

class C : public B { class A myA; };

or

class C : public B { ::A myA; };

Regards,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]