Process finished with exit code 133 (interrupted by signal 5: SIGTRAP)
解决方案:把析构函数也设置成虚函数
//父类 .cpp 文件
class identity {
public:
//如果基类里面有虚成员函数,则最好把析构函数也设置为虚函数
//否则,派生类在用基类指针调用时,发生内存泄露,析构时不会调用派生类的析构函数
virtual ~identity() = 0;
//操作菜单(纯虚函数)
virtual void submeun() = 0;
public:
string name;//姓名
string pwd;//密码
};
//父类 .h 文件
#include "identity.h"
identity::~identity() {}