Sollicitatievraag bij Bloomberg

how does a reference counting smart pointger work?

Antwoord op sollicitatievraag

Anoniem

4 jan 2010

I remeber the smart pointer is a class with a pointer member which points to the actual object and a counter member to record how many pointers point to the object. If the number of the counter is 0, then call the destructor function to delete the object. This smart pointer is to provent dangle pointer.