template <typename T>
class CTemp {
T x,y;
public:
CTemp() {}
CTemp(T x,T y) {
this->x = x;
this->y = y;
}
// ...
CTemp<T> operator +(const CTemp<T> &obj) const {
return CTemp<T>((x + obj.x),(y + obj.y));
}
// ...
};
void Main() {
CTemp<int> temp1(5,5);
CTemp<float> temp2(1.0f,1.0f);
// Clearly won't work since no conversion
// operators have been specified, but how
// (if possible) to specify them?
temp1 = temp1 + temp2;
}