Redirected from Generics
Among OOP languages, C++, Beta, Eiffel, Ada, and later versions of Java provides generic facility. In C++, templates support generics and popularized the notion of generics.
For example, in C++ code,
template <typename T>
T max (T x, T y)
{
if (x < y)
return y;
else
return x;
}
In this case, a pseudo-datatype T is called "subtype". T can be anything that can be compared.
See also Partial evaluation
|
Search Encyclopedia
|
Featured Article
|