I am not able to understand following behaviour in c++.I am using gcc 4.4.1
#include<iostream>
using namespace std;
class call{
        private:
        int *ptr;
    public :
    call()
    {
    cout<<"\nConstructor called\n";
    }
    void allocate()
    {
            ptr=new int[10];
    }
    void test()
    {
            cout<<"\nTesting\n";
    }
    ~call()
     {
            if(ptr)
            {
             cout<<"\nptr deleted\n";
             delete [] ptr;
                     ptr=NULL;
            }
      }
};
int main()
{
    call *p=new call();
    p->allocate();
    p->test();
    delete p;
    p->test();
    p->test();
    p->allocate();
    p->test();
    p->test();
return 0;
}
OUTPUT :
Constructor called
Testing
ptr deleted
Testing
Testing
Testing
Testing
In the above code , even after deleting object (delete p) , I am still able to access member function(void test()) of the class. How c++ is allowing me to access member function of the class if that object is deleted.
 
     
    