logoalt Hacker News

atomicnumber3last Sunday at 4:37 PM1 replyview on HN

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?


Replies

fake-namelast Sunday at 5:54 PM

- 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->`)

show 2 replies