Generics question
Hi every body,
In the following code
publicclass Test<T>{
publicvoid test(T t
t.execute()
}
}
i want to apply a method execute on the object t: I know that this method exists since T will only have 3 differents values in my application. How tell to the compiler than T will be T1, T2 or T3 all with the execute method.
Should i have to write a superT class and tells to my generics classe somethin like
publicclass Test<Textends superT>{
}
or have i to use an other solution and what is this solution ?
Thanks
Manu
PS: is it possible in C++ to write the same code
publicclass Test<T>{
publicvoid test(T t
t.execute()
}
}
without a compil error and only a runtime error ?

