多态循环调用子类函数,总是在最后一个闪退,提示Unable to step next. Operation failed with error code 0x80004004.
for (int i = 0; i < this->m_EmpNum; i++)
{
// 多态调用接口
this->m_EmpArry[i]->showInfo();
}
void Employee::showInfo()
{
cout << "职工编号:" << this->m_Data.m_ID;
cout << "\t职工姓名:" << this->m_Data.m_Name;
cout << "\t职工性别:" << ((this->m_Data.m_Sex) ? "男" : "女");
cout << "\t职工岗位:" << this->getDeptName()
<< "\t岗位职责:完成经理交给的任务" << endl;
}
运行结果及报错内容
Unable to step next. Operation failed with error code 0x80004004.
每次到最后一个数据的时候会出错
完整源码
文件大小:156.0 K|
https://linxilts.lanzouy.com/iGl890bwublg