C ++: herança e sobrecarga do operador
Eu tenho duas estruturas:
template <typename T>
struct Odp
{
T m_t;
T operator=(const T rhs)
{
return m_t = rhs;
}
};
struct Ftw : public Odp<int>
{
bool operator==(const Ftw& rhs)
{
return m_t == rhs.m_t;
}
};
Eu gostaria que o seguinte fosse compilado:
int main()
{
Odp<int> odp;
odp = 2;
Ftw f;
f = 2; // C2679: no operator could be found
}
Existe alguma maneira de fazer isso funcionar ou devo definir o operador emFtw
também?