我目前正在一个银行系统上工作以完成一项任务,我有一个拥有一系列账户的客户,我试图输出数组中每个账户的金额。它说我需要使用我认为但不确定我会做什么的指针。 :s
double customer:: getAccounts()
{
for (int i=0;i<5;i++)
{
if(Accounts[i].getBalance != 0)
{
double x = Accounts[i].getBalance;
return x;
}
}
}
double customer :: specAccount(int num)
{
double x = Accounts[num].getBalance;
return x;
}
错误 C3867:“Account::getBalance”:函数调用缺少参数列表;使用 '&Account::getBalance' 创建指向成员的指针
最佳答案
假设 getBalance 是一个方法:
double x = Accounts[num].getBalance();
或者如果 Accounts 是一个指针数组:
double x = Accounts[num]->getBalance();
关于C++ 指针帮助缺少参数列表用户帐户::getBalance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20253512/