I have a nested class declared as:

class A
{
    class B
    {
         // members
    };

    // members
};

Is there a good way to avoid typing A::B every time I need to access B's members? I'd just like to do this in one .cpp file. I tried "using namespace A;" but I found out that class scopes and namespace scopes are not the same thing.

You need to declare A as a namespace. Then you can put

using A::B;

once and just use the class name.

typedef A::B B ;

// ...
commented: thanks +2

Thanks, typedef was what I was looking for!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.