使用正确的操作数
Using the correct operand
本文关键字:操作数 更新时间:2023-10-16
我正在尝试实现一个从帐户获取余额并减去给定金额的系统。这是我的方法。
transaction withdraw(double amount, double ID){
Account Temp(NULL,NULL,NULL,NULL,NULL);
Temp = Llist.search(ID); //Returns an Account Objet
Temp.setBalance(Temp.getBalance - amount); //Here is the error, '-' illegal, left operand has type 'double (_thisCall Account::* )(void)'
string t = "Withdraw";
transaction trans(t, amount, ID, name);
return trans;
}
我问我会在行中放入哪个操作数,以正确减去"Temp.getbalance"中的"a"
不要忘记函数调用的括号 - 否则你试图从函数指针中拿走一个双精度!
Temp.setBalance(Temp.getBalance() - amount);
相关文章:
- 控制允许动态运行c++的并发操作数
- 为什么C++逐位AND运算符在不同大小的操作数中表现为这样
- 错误 C2679:二进制"<<":未找到采用类型 'std::string_view' 的右侧操作数的运算符(或者没有可接受的转换)
- C++ 带有向量的 IF 计算操作数
- 是否所有C++运算符都接受操作数?
- 一元*运算符的操作数是否期望一个 prvalue
- 与'operator='不匹配(操作数类型'String'且"void")
- 不正确的操作数类型 MSVC
- C2678 二进制 '==':未找到采用 'Card' 类型左操作数的运算符(或者没有可接受的转换)
- 错误:类型"double()"和"double()"的操作数无效到二进制&quo
- 我的运算符重载是否有效<<(流插入)左操作数不是 ostream
- 没有运算符"="与这些操作数匹配,JUCE 窗口演示应用程序
- 如果我在指针中使用 ++ 操作数,我的值就会出错
- 二进制表达式的操作数无效 - 使用 for 和迭代器
- C2679 二进制"<<":未找到采用右操作数类型的运算符
- CPP 运算符重载操作数位置 [] 与 ==
- int* 和 int[] 类型对二进制运算符 + 的操作数无效
- 错误:二进制'operator*' 'float'和'float[0]'类型的操作数无效
- 运算符'<'不能应用于类型 'string' 和 'string' 的操作数
- 非法,左操作数具有类型 'DWORD [29]'