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. Advertising

  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. 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. coala
    Replies:
    3
    Views:
    375
    coala
    Sep 6, 2006
  2. Javier
    Replies:
    2
    Views:
    565
    James Kanze
    Sep 4, 2007
  3. aneuryzma
    Replies:
    3
    Views:
    713
    Jim Langston
    Jun 16, 2008
  4. Hicham Mouline
    Replies:
    100
    Views:
    2,085
    Noah Roberts
    Aug 25, 2009
  5. Christopher
    Replies:
    4
    Views:
    445
    Ruben Safir
    Jul 9, 2011
Loading...

Share This Page