470,815 Members | 1,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

hiding mechanism, FAQ 23.9

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
Jun 27 '08 #1
2 963
Qimonda wrote:
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 does. But, FCOL, why didn't you just try it and see for yourself?
};

At least g++ stops issuing warning messages with the using declaration.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #2
Qimonda wrote:
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
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.