overloading free functions and inheritance

Discussion in 'C++' started by sb, Feb 20, 2004.

  1. sb

    sb Guest

    void f(const base& x) {}

    class derived : public base {};

    void f(const derived& x) {
    //
    //... Can I call the other f from here?
    //
    }
    sb, Feb 20, 2004
    #1
    1. Advertising

  2. "sb" <> wrote...
    > void f(const base& x) {}
    >
    > class derived : public base {};
    >
    > void f(const derived& x) {
    > //
    > //... Can I call the other f from here?
    > //
    > }


    You could try:

    f(static_cast<const base&>(x));

    Victor
    Victor Bazarov, Feb 20, 2004
    #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. Xiangliang Meng
    Replies:
    1
    Views:
    1,591
    Victor Bazarov
    Jun 21, 2004
  2. cppsks
    Replies:
    0
    Views:
    814
    cppsks
    Oct 27, 2004
  3. Replies:
    3
    Views:
    351
  4. Hicham Mouline
    Replies:
    0
    Views:
    431
    Hicham Mouline
    Apr 23, 2009
  5. Hicham Mouline
    Replies:
    1
    Views:
    412
    Michael DOUBEZ
    Apr 24, 2009
Loading...

Share This Page