This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: using keyword problem


Hi Artur,

The "using" keyword is for bring identifiers from one namespace available in the current namespace.

For example:
using std::cout; // cout is now accessible, without the std:: qualifier.
using namespace std: // the whole std:: uberverse is accessible. Avoid collisions!


A class and a struct or sort of like namespaces, and also not like namespaces.

You want to do this...

class A
{
public:
    struct S
    {
        int x;
    };
};

int Method()
{
    typedef A::S S; // using A::S is no good here.

    S s;
    s.x = 1;
    return s.x;
};

HTH,
--Eljay


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