Topic: Wording in the standard about hiding of names from derived class brought by using-declaration


Author: shirarenai@yandex.ru
Date: Fri, 24 Apr 2009 17:07:31 CST
Raw View
I mean the wording in 7.3.3#15 of the standard: "When a using-
declaration brings names from a base class into a derived class scope,
member functions and
member function templates in the derived class override and/or hide
member functions and member function
templates with the same name, parameter-type-list (8.3.5), and cv-
qualification in a base class (rather than
conflicting)".

First, if cv-qualification is mentioned, the ref-qualifiers are worth
mentioning too. Second, wouldn't it be better to formulate it in other
terms, namely: "...a member function or a member function template in
the derived class hides a member function or a member function
template from a base class if these two functions are not overloadable
(rather than
conflicting)". Example:

struct A
{
     static void f ();
     void g () &;
     void h () &;
};

struct B : A
{
     using A::f;
     using A::g;
     using A::h;

     void f () const;        //A::f is hidden
     void g ();              //A::g is hidden
     void h () &&;           //A::h is visible
};


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]