i already searched stackoverflow and read that exit() cause memory leak
so i thought i could not avoid memory leak when i use this code
class A
{
public:
int* m_pM;
A() { m_pM = new int(1); };
~A() { delete m_pM; };
public:
void Exit() { exit(0); }
};
int main()
{
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
A a;
a.Exit();
}
So I asked the professor to move on to this problem
but my professor said me to work it out.
i dont know what to do... maybe she didn't think much about this problem.
she just said dont cause memory leak.
is there any solution that i dont know? ( not use return only use exit())