Smart Pointer release() const : it can set the pointer to null with the keyword "const"?

Discussion in 'C++' started by coala, Sep 6, 2006.

  1. coala

    coala Guest

    In Smart Pointer class, we have a piece of code:

    inline void release(void) const { if (mPtr) mPtr->release(); mPtr = 0;
    }

    It can set mPtr but it is still const?

    Why could this work and why it can be compiled? We have used it for
    years.

    Thanks.

    - C.
     
    coala, Sep 6, 2006
    #1
    1. Advertisements

  2. coala wrote:
    > In Smart Pointer class, we have a piece of code:
    > [..]


    You already asked that, three hours ago. Is there something you
    didn't understand in the answers given? Do you not know how to
    see the responses you've got so far? (if so, fat chance getting
    this this question to be answered...)

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Sep 6, 2006
    #2
    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. Replies:
    5
    Views:
    30,247
    Mike Schilling
    Mar 29, 2006
  2. coala
    Replies:
    3
    Views:
    578
    coala
    Sep 6, 2006
  3. G
    Replies:
    3
    Views:
    598
    Sylvester Hesp
    Jan 8, 2007
  4. Javier
    Replies:
    2
    Views:
    895
    James Kanze
    Sep 4, 2007
  5. aneuryzma
    Replies:
    3
    Views:
    975
    Jim Langston
    Jun 16, 2008
  6. Hicham Mouline
    Replies:
    100
    Views:
    2,624
    Noah Roberts
    Aug 25, 2009
  7. Disc Magnet
    Replies:
    1
    Views:
    826
    Ian Collins
    May 6, 2010
  8. Christopher
    Replies:
    4
    Views:
    648
    Ruben Safir
    Jul 9, 2011
Loading...