What are the differences between “generic” types in C++ and Java?
Java has generics and C++ provides a very strong programming model with template s. So then, what is the difference between C++ and Java generics? Alexandru Nedelcu There is a big difference between them. In C++ you don't have to specify a class or an interface for the generic type. That's why you can create truly generic functions and classes, with the caveat of a looser typing. template <typename T> T sum(T a, T b) { return a + b; } The method above adds two objects of the same type, and can be used for any type T that has the "+" operator available. In Java you have to specify a type if you