#include <cmath>
#include <iostream>
#include <cstdlib>
using namespace std;
class myClass {
int d;
public:
myClass(){};
int get_rand() const {
return rand() % 10;
}
};
int operator +(myClass d, myClass e) {
return d.get_rand() + e.get_rand();
}
int main() {
myClass mC;
int sum = mC + mC;
cout << sum;
}
我希望能够拥有尽可能多的 Mc,例如。int sum = mC + mC + mC + mC;