Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^2: DESTROY Function call

by Anonymous Monk
on Jul 17, 2018 at 19:57 UTC ( #1218690=note: print w/replies, xml ) Need Help??

in reply to Re: DESTROY Function call
in thread DESTROY Function call

I think that this is what C++ actually does, too: objects are reference-counted, and reaped ... or, available to be reaped soon ... when the count becomes zero.

Replies are listed 'Best First'.
Re^3: DESTROY Function call
by Corion (Pope) on Jul 17, 2018 at 20:10 UTC

    No. Objects in C++ are not reference counted in general.

    The C++ FAQ on Destructors discusses many of the topics also touched upon here.

    Objects as a local variable will have their destructor called on the closing bracket, and there cannot be a reference to them in valid code. So reference counting makes no sense in that context.

    Objects created with new need to be explicitly disposed of by using delete. No reference counting is in play there either.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1218690]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2021-01-28 08:41 GMT
Find Nodes?
    Voting Booth?