run time problem in inheritance.



Hi all,

I have a problem. When i am deleting object my programe immediately crash. I
dont know what is the reson behind this.(I think problem is like i am delete
some stack variable.)

#include<iostream>
using namespace std;
class Base {
private:
int i;
public:
Base(){i = 999;}
void show() {
cout<<"value of i is..."<<i<<endl;
}
};
class Der : public Base {
private:
int d;
public:
Der(){d = 100;}
virtual void show() {
cout<<"value of i is..."<<d<<endl;
}
};
int main() {
Base *obj = new Der;
obj->show();
delete obj;
return 0;
}


.