Generic Types and Methods
- slide 14 : 21
Generic interfaces: IComparable<T>
We illustrate generic interfaces with
IComparable
A reproduction of the non-generic interface
IComparable
.
A reproduction of the generic interface
IComparable<T>
.
A class Die that implements
IComparable
.
A class Die that implements
IComparable<T>
.
The implementation of the generic interface is more type safe and less clumsy than the implementation of the non-generic solution