[ Terminology on generics types ]
When I read about generic programming, often, are used this two terms:
- parametrized types;
- type parameters
Are there difference between them?
Answer 1
In Java, in the following declaration
public class Foo<T> { ... }
Foo
is a parameterized type. T
is a type parameter.
Answer 2
Using C++ terminology:
A class template corresponds to a parameterised type - it becomes a type once you specify arguments for the parameters.
A type parameter is a parameter of a template, for which the arguments are types.
Answer 3
Generic types are also known as parametized types.
Type parameters refers to the types associated with a generic type. For example, with
Dictionary<T1, T2>
T1 and T2 are the type parameters.