Topic: qualified name lookup


Author: "Mando Gali" <M.Gali@deutschepost.de>
Date: 1999/06/30
Raw View
Hi!

I would like to know your opinions about the following case of
qualified name lookup. Let consider the example listed below.
I looked in the standard specification but I am not sure of what
is the right way a compiler has to proceed.


Let us consider the qualified identifier N::A::B in the member function h.
Which B is meant according to the standard C++ in the function h with
 N::A::B  b;
is it ::N::A::B or ::C::N::A::B ?

The name lookup is in two steps: first name lookup for the nested name
specifier N::A
of the qualified identifier N::A::B and then unqualified name lookup of B in
the scope N::A.
The question is now how to proceed for the first step.
Thanks for any hint.

Mando Gali

class C{

 public :
  class N{

   public :
    class A {

     public:
      class B

       public: void f(){ cout<<"::C::N::A::B::f()"<<endl; }
      };
    };
  };

};


class N{

 public:
  class A : public C{

   public:
    class B

     public :
      void f(){ cout<<"::N::A::B::f()"<<endl; }
    };

    void
{
     N::A::B  b;
     b.f();
    }

 };


};


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]