问题遇到的现象和发生背景
就是想要更新一个对象的数据
问题相关代码,请勿粘贴截图
void SavingsAccount::deposit(Date date, double amount) {//在date存入amount
this->accumulation += accumulate(date);
this->lastDate = date;//这一句clion提醒我,date是一个从未使用的变量。经过调试我也发现lastDate就没有更新
this->balance += amount;
total += amount;
cout << date.getYear() << "-" << date.getMonth() << "-" << date.getDay() << "\t" << this->id << "存入" << amount << "元" <<endl;
}
我想要达到的结果
他们都是同一个类,类的成员变量也很简单只有三个int类型的数据
想要让lastDate对象内的数据更新为date中的数据