#include <iostream>
using namespace std;
class Distance {
private:
int meters;
public:
Distance(int m) : meters(m) {}
// your code here: define operator+ to add two Distance objects
// operator+() is called from Distance1 with Distance2
// Ex: Distance d3 = d1.operator+(d2)
Distance operator+(const Distance &d2) const {
return Distance(meters + d2.meters);
}
int getMeters() const {
return meters;
}
};
int main() {
int a, b;
cin >> a >> b;
Distance d1(a);
Distance d2(b);
Distance total = d1 + d2; // must use overloaded operator
cout << "Total=" << total.getMeters();
return 0;
}