I observed some unexpected behavior with the delete semantics. For example, using the following C++ code:
class Base{
    public:
         Base(int tmp) : x(tmp) {}
         ~Base() { std::cout << "Inside Base::~Base()" << std::endl; }
         void foo() { std::cout << "Inside Base::foo()" << std::endl; }
         int x;
};
...
int main(int argc, char** argv)
{
    Base* b = new Base(10);
    delete b;
    b->foo(); 
    std::cout << "b->x: " << b->x << std::endl;
}
I received the following output from Visual Studio 2008:
Inside Base::~Base()
Inside Base::foo()
b->x: 2359492
Why after the call to delete b, I am still able to call the Base::foo() method?
Thanks, Chris
 
     
     
     
    