0
Is this bug or....
When I remove comment program ends immediately. Is this bug or normal behavior? #include <iostream> using namespace std; class MyClass { public: MyClass(); ~MyClass(); }; MyClass::MyClass() { cout<<"Constructor"<<endl; } MyClass::~MyClass() { cout<<"Destructor"<<endl; } int main() { MyClass obj, obe; // remove comment to execute delete // delete &obe; cout << "EOP" << endl; }
4 Answers
+ 1
Thanks KrOW
0
what do you mean by removing comment?
0
I mean when I remove comment in front of delete command and actually execute delete &obe
0
Its not a bug... If you delete sometuing that you have NOT allocated dynamically, you get unexpected behaviours (crash)