This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: using keyword problem
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: artur at alice dot phy dot uct dot ac dot za, gcc-help at gcc dot gnu dot org
- Date: Fri, 27 Aug 2004 07:17:34 -0500
- Subject: Re: using keyword problem
- References: <200408271352.03444.artur@alice.phy.uct.ac.za>
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