Re: Inheritance of overloaded functions

Discussion in 'C++' started by Joe P, Jun 21, 2005.

  1. Joe P

    Joe P Guest

    On Mon, 20 Jun 2005 13:08:51 -0400, Victor Bazarov wrote:

    > The 'filterDSP::Get()' _hides_ the 'filter::Get(float)' function.
    >
    >
    >> }
    >>
    >> One could argue that this is due to r.13.1 But I need more ;-)

    >
    > I guess that one could, but I wouldn't argue that. You have a very simple
    > case of *name hiding*.


    Where does this name hiding feature arise and why? Other languages don't
    seem to need it.
    Joe P, Jun 21, 2005
    #1
    1. Advertising

  2. Joe P

    Pete Becker Guest

    Joe P wrote:
    >
    > Where does this name hiding feature arise and why? Other languages don't
    > seem to need it.
    >
    >


    struct Base
    {
    };

    struct Derived : Base
    {
    void f(double);
    };

    void test()
    {
    Derived d;
    d.f(3);
    }

    So far, so good. Now imagine Base is defined in some third party
    library, and in a maintenance release they change it:

    stuct Base
    {
    void f(int);
    };

    If Base::f is considered in the possible matches for the call d.f(3) it
    wins, and you've got a change in behavior.

    --

    Pete Becker
    Dinkumware, Ltd. (http://www.dinkumware.com)
    Pete Becker, Jun 21, 2005
    #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. DX
    Replies:
    3
    Views:
    401
  2. DX
    Replies:
    0
    Views:
    356
  3. Replies:
    8
    Views:
    362
  4. jrraines

    overloaded name + inheritance

    jrraines, Mar 20, 2010, in forum: C++
    Replies:
    1
    Views:
    451
    Michael Tsang
    Mar 22, 2010
  5. John Wickerbee

    Inheritance of overloaded ++ operator issue

    John Wickerbee, Oct 2, 2011, in forum: C Programming
    Replies:
    0
    Views:
    417
    John Wickerbee
    Oct 2, 2011
Loading...

Share This Page