#include <iostream>
using namespace std;
struct box
{
long num;
int operator+(const box &b1,const box &b2) const
{
return b1.num + b2.num;
}
box b_one,b_two;
int main()
{
b_one.num = 2000;
b_two.num = 2000;
cout << b_one + b_two;
return 0;
操作系统:Windows 10
初步解决方法:删除const
,方法没有效果