编译程序时出现此错误,但我没有发现代码有任何问题。
错误1错误C3867:' President :: getFirstName':函数调用缺少参数列表;使用'& President :: getFirstName'创建指向成员的指针h:\ president_folder \ president_folder \ president_driver.cpp 95 1 president_folder
我不确定如何解释它。
//outputData function
void outputData(President prez_array[],fstream &outFile, int count)
{
for(int i = 0; i < count; i++)
{
outFile << prez_array[i].getFirstName << endl;
outFile << prez_array[i].getLastName << endl;
outFile << prez_array[i].getBeginYear << endl;
outFile << prez_array[i].getEndYear << endl;
outFile << prez_array[i].getPartyAffil << endl;
outFile << endl;
}
}
答案 0 :(得分:1)
看起来你忘记了如何调用函数:
outFile << prez_array[i].getFirstName() << endl;
outFile << prez_array[i].getLastName() << endl;
outFile << prez_array[i].getBeginYear() << endl;
outFile << prez_array[i].getEndYear() << endl;
outFile << prez_array[i].getPartyAffil() << endl;