3 ms·
Guarantees at compile time: Array<double> means the only element you will encounter is a double. Array<ISomeInterface> means the only element you will encount
by je42 12y ago
Guarantees at compile time:
Array<double> means the only element you will encounter is a double.
Array<ISomeInterface> means the only element you will encounter is of type ISomeInterface.
hence, you can express part of some code's requirements via the types that a function,class exposes and/or requires.
these requirements can then be checked at compile time.
without this you have to defer the "checking" to runtime.
- Kiro 12y agoI'm sorry, I meant why generics are a big deal. Thanks though!