2 , , . - .
, int int B 1-arg . . "" , .
Uri, : , API, . A a B int? , a b, getX ?
, , A B ints? , , A int B int int(). a + b int , :
#include <iostream>
struct A {
int x;
explicit A(int _x) : x(_x) {}
operator int() {
return x;
}
};
struct B {
int x;
explicit B(int _x) : x(_x) {}
operator int() {
return x;
}
};
int main() {
A a(2);
B b(2);
std::cout << a + b << "\n";
std::cout << a - b << "\n";
}