c++ - C++ 问题:[Error] 语句无法解析重载函数 x2 的地址
问题描述
我在这里完全是个菜鸟,需要帮助。希望比我有经验的小伙伴们帮帮我。
非常感谢任何输入。
由于代码太长,因此代码的运行方式如下:
#include <iostream>
using namespace std;
class Payslip
{
string name, pay_grade;
float salary, oth, otp, gross, net, tax, sss, pagibig, philhealth;
public:
void payslipdetails()
{
// Extremely long, but this part of the code would allow me to allow user to input their names, their base salary, and overtime hours.
sss = 500;
pagibig = 200;
philhealth = 100;
otp = oth * (salary*0.01);
gross = salary + otp;
net = gross - (tax + sss + pagibig + philhealth);
// then a series of if/else if condition if salary is greater/less than or equals to, and we divide the said salaries into pay grade A or B.
/* Example:
if (salary >= 10000 && salary <= 19999)
{
// Pay grade A
if (salary >= 10000 && salary <= 14999)
{
pay_grade = "A";
}
// Pay grade B
else if (salary >= 15000 && salary <= 19999)
{
pay_grade = "B";
}
tax = gross * 0.10;
}*/
}
}
void display_details()
{
cout<<"\n Employee Name : " << name;
cout<<"\n Basic Salary : " << salary;
cout<<"\n Pay Grade : " << pay_grade;
cout<<"\n No. of OT hours : " << oth;
cout<<"\n OT Pay : " << otp;
cout<<"\n Gross Pay : " << gross;
cout<<"\n Withholding Tax : " << tax;
cout<<"\n Net Pay : " << net;
}
};
int main()
{
Payslip d;
d.payslipdetails;
d.display_details;
return 0;
}
d.payslipdetails 和 d.displaydetails 有错误。我希望这比我上一篇文章更清楚!
错误是:[Error] 语句无法解析重载函数的地址
我不知道该怎么做...
解决方案
您是否可能尝试在对象上调用方法d
?然后,您至少需要添加括号。对于每个函数调用:
d.payslipdetails();
推荐阅读
- javascript - performance.now() 上的 toFixed() 行为
- javascript - 如何在 Node.js 中正确进行数据存储查询?
- reactjs - create-react-app 自版本 4.0.1 起无法正常工作
- javascript - 在 React-three-fiber 的 GLTF 模型上动态编辑材料
- r - Tidymodels 包:使用 R 中的 juice() 和 bake() 函数进行模型预测以找到最佳模型拟合
- classification - 如何以 zarr 格式动态存储一组图像和标签?
- opencv - 我想检测段落中所有带下划线的单词
- python - 当当前时间某处有零时,将其转换为二进制失败
- c++ - 递归函数在 0x79B20AD2 (ucrtbased.dll) 处引发未处理的异常
- wordpress - 使用 htaccess 将所有页面重定向到单个页面?