Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Data structures and Algorithms in C/C++11. Parent comment
class B : public A { ... } void foo() { A* someA = new B(...); ... delete someA; }
if A destructor is not virtual, then B's resources leak.
There are no comments on this comment yet.
class B : public A { ... } void foo() { A* someA = new B(...); ... delete someA; }
if A destructor is not virtual, then B's resources leak.