我有课程连接:
class Connection{
public: Connection(string usr, string pwd);
~Connection();
private:
Engine * pEngine;
AdmCallbacks * pAdmCallbacks;
Callbacks * pCallbacks;
char * fake[11];
int iFlags;
int iCode;
};
~Connection()
{
delete pEngine;
delete pCallbacks;
delete pAdmCallbacks;
}
在main.cpp中的我做了这段代码:
#include <iostream>
#include "Connection.h"
using namespace std;
int main()
{
Connection *connection = new Connection("test","test");
if (logedin)
//do something
else delete connection;
if (connection != NULL)
cout << "WTF" << endl;
return 0;
}
输出:
WTF
为什么呢?我不明白为什么记忆没有处理..请帮帮我,谢谢!