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; }

8th Jul 2018, 6:50 AM
Besko M
4 ответов
+ 1
Thanks KrOW
8th Jul 2018, 7:56 AM
Besko M
0
what do you mean by removing comment?
8th Jul 2018, 7:01 AM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar
0
I mean when I remove comment in front of delete command and actually execute delete &obe
8th Jul 2018, 7:06 AM
Besko M
0
Its not a bug... If you delete sometuing that you have NOT allocated dynamically, you get unexpected behaviours (crash)
8th Jul 2018, 7:34 AM
KrOW
KrOW - avatar