class A { public: int do() { return 1; } };
class B { public: int do() { return 2; } };
template <typename T> int do(T t) { return t.do(); } class A { public: int do() { return 1; } };
class B { public: int do() { return 2; } };
template <typename T> int do(T t) { return t.do(); } do<A>(a)
do<B>(b)
Can I take any arbitrary type with an "int do()" method and use that with do? Like: do(Arbitrary)It should work without the template parameter: do(a), do(b)
"Can I take any arbitrary type with an "int do()" method and use that with do?"
Yes.
It's not the case here, so it just works.