class Widget
{
public:
Widget() {
cout<<\"~Widget()\"<
The object destructor is called before the delete operator. So my guess would be that it tries to call the destructor, realizes that the pointer is NULL therefore
As Neil said, if w contains a Widget, it should work.