hiding mechanism, FAQ 23.9

Q

Qimonda

FAQ 23.9 explains the hiding mechanism und the use of using declarations to
un-hide base class member functions.

Will this also work when the base class has multiple overloads which are
hidden?

Example:

class Base
{
public:

virtual void f( double ) {}; // all member functions defined here.
virtual void f( double * ) {};
virtual void f( double ** ) {};
};

class Derived : public Base
{
public:

virtual void f( double x ) { /*do sth. with x */ };
using Base::f; // Does that un-hide all other overloads in Base, i.e.
Base::f( double * ) and Base::f( double ** )?
};

At least g++ stops issuing warning messages with the using declaration.

Best regards,

Georg

Qimonda AG
Chairman of the Supervisory Board/ Aufsichtsratsvorsitzender: Peter J.
Fischl
Management Board/ Vorstand: Kin Wah Loh (Chairman/ Vorsitzender), Dr.
Michael Majerus, Thomas J. Seifert
Register Court/ Registergericht: München HRB 152545, Seat/ Sitz: München
 
B

Bo Persson

Qimonda said:
FAQ 23.9 explains the hiding mechanism und the use of using
declarations to un-hide base class member functions.

Will this also work when the base class has multiple overloads
which are hidden?

Example:

class Base
{
public:

virtual void f( double ) {}; // all member functions defined here.
virtual void f( double * ) {};
virtual void f( double ** ) {};
};

class Derived : public Base
{
public:

virtual void f( double x ) { /*do sth. with x */ };
using Base::f; // Does that un-hide all other overloads in Base,
i.e. Base::f( double * ) and Base::f( double ** )?
};

It "unhides" the name f, making it visible here. The compiler will
then have to see what f means (possibly several things).


Bo Persson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top