All pastes #929817 Raw Edit

Someone

public text v1 · immutable
·published 2008-03-06 01:20 UTC
rendered paste body
class Foo {
public:
        Foo () { }

        void unref () { delete this; }
protected:
        ~Foo () { }
};

class Bar : public Foo {
};

int
main()
{
  Foo* f = new Foo ();
  f->unref ();

  f = new Bar ();
  f->unref ();
}