Forgive me, I'm a Java programmer.
The glaring bug here is that ptr is - or rather the object being pointed to is - on the heap and allocated in the constructor, but the deconstructor doesn't free it?
- ptr isn't declared in the class body
- ptr is not being deallocated in the destructor
(personal preference - use of class member without explicit `this->`)
- ptr isn't declared in the class body
- ptr is not being deallocated in the destructor
(personal preference - use of class member without explicit `this->`)