Andrej Mitrovic <andrej.mitrov...@gmail.com> wrote:

Does it really make sense for a class to have methods that accept any
type of argument? It's one thing to have a class specialized on some
type(s), e.g.:

class Foo(T1, T2)
{
    void bar(T1 var, T2 etc) { }
}

But having a class method which can accept any type, that seems odd to
me. I don't know since I've never used such a thing before, but maybe
it has some good use cases? (I'd love to know about those btw!).

Well, operator overloading comes to mind. Certainly for types that
would allow mathematical operations with any generic numeric type.


You can introduce constraints, but I thought having parameterized
classes would solve most of the use-case scenarios.


--
Simen

Reply via email to