I have such a template class
template <class T>
class foo{
// some stuff here
};
How do I make sure that class T has some methods? For example T has to be comparable.
Why bother? If the user forgets to write operator== or operator!= it won't compile anyway,
just as it would not compile if you made operator== and/or operator!= pure virtual in a base
class and forgot to override them in a derived class.
Well... just because they are interviewing you doesn't mean they are a super genius.
Operator overloading and inheritance don't mix well, so I would argue against the
pure virtual approach here. But if T has to have a frobnicate() method, then perhaps
pure virtuals in a base class is the answer (though still I would argue that in itself,
I'd do nothing and let the compiler complain).