hiding mechanism, FAQ 23.9

Discussion in 'C++' started by Qimonda, Jun 18, 2008.

  1. Qimonda

    Qimonda Guest

    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
    Qimonda, Jun 18, 2008
    #1
    1. Advertising

  2. Qimonda

    Bo Persson Guest

    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
    Bo Persson, Jun 18, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. piyush
    Replies:
    0
    Views:
    1,846
    piyush
    Jul 14, 2004
  2. Muhammad Shuaib Anjum
    Replies:
    2
    Views:
    638
    Muhammad Shuaib Anjum
    Aug 13, 2004
  3. Sh4wn
    Replies:
    163
    Views:
    2,592
    Luis Zarrabeitia
    Jun 12, 2008
  4. Dré

    FAQ-page => showing/hiding text

    Dré, Feb 9, 2004, in forum: Javascript
    Replies:
    5
    Views:
    105
    Bas Cost Budde
    Feb 9, 2004
  5. Ste
    Replies:
    41
    Views:
    808
    Thomas 'PointedEars' Lahn
    Aug 1, 2007
Loading...

Share This Page