I am trying to understand memory management in C++.
Here's my code:
Person *P5 = new Person();
delete P5;
std::cout<<P5->getWeight()<<std::endl;
delete P5;
std::cout<<P5->getWeight()<<std::endl;
My first cout works and the 2nd doesn't,where as I used delete
before both. Can anyone explain this?