Content deleted Content added
m Correcting a typo |
CanisRufus (talk | contribs) m RedWolf - dab Polymorphism |
||
Line 1:
In [[computer science]], '''generics''' is a technique that allows one value to take different [[datatype]]s (so-called [[polymorphism (computer science)|polymorphism]]) as long as certain contracts such as [[subtype]]s and [[signature (computer science)|signature]] are kept. The programming style emphasizing use of this technique is called '''generic programming'''.
For example, if one wanted to create a list using generics, a possible declaration would be to say <tt>List<T></tt>, where <tt>T</tt> represented the type. When instantiated, one could create <tt>List<Integer></tt> or <tt>List<Animal></tt>. The list then, is treated as a list of whichever type is specified.
|