When I read about generic programming, often, are used this two terms:
- parametrized types;
- type parameters
Are there difference between them?
When I read about generic programming, often, are used this two terms:
Are there difference between them?
In Java, in the following declaration
public class Foo<T> { ... }
Foo
is a parameterized type. T
is a type parameter.
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.
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.