Overloading a function with const input parameter?

Discussion in 'C++' started by Plissken.s@gmail.com, Feb 27, 2006.

  1. Guest

    Hi,

    Is it possible to over load a function of a class with const input
    parameter ?
    class A {
    public:
    void aFunc(const B& b);
    void aFunc(B& b);
    }

    and they have different implementation:
    A::aFunc(const B& b) {
    //....
    }
    A::aFunc(B& b) {
    //....
    }
     
    , Feb 27, 2006
    #1
    1. Advertisements

  2. wrote:
    > Is it possible to over load a function of a class with const input
    > parameter ?
    > class A {
    > public:
    > void aFunc(const B& b);
    > void aFunc(B& b);
    > }
    >
    > and they have different implementation:
    > A::aFunc(const B& b) {
    > //....
    > }
    > A::aFunc(B& b) {
    > //....
    > }


    Why ask when you can simply try it?

    V
    --
    Please remove capital As from my address when replying by mail
     
    Victor Bazarov, Feb 27, 2006
    #2
    1. Advertisements

  3. Guest

    yes its possible, and as vic said, try and c
     
    , Feb 27, 2006
    #3
    1. Advertisements

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. Polanski24
    Replies:
    1
    Views:
    729
    Rolf Magnus
    Apr 11, 2005
  2. Replies:
    11
    Views:
    1,383
  3. Fabian Wein
    Replies:
    8
    Views:
    741
    terminator
    Jul 26, 2007
  4. Javier
    Replies:
    2
    Views:
    874
    James Kanze
    Sep 4, 2007
  5. 0m
    Replies:
    26
    Views:
    1,466
    Tim Rentsch
    Nov 10, 2008
  6. fungus
    Replies:
    13
    Views:
    1,206
    fungus
    Oct 31, 2008
  7. Replies:
    2
    Views:
    680
    Andrew Koenig
    Feb 9, 2009
  8. none
    Replies:
    3
    Views:
    3,640
    James Kanze
    May 20, 2010
Loading...