Generic programming: Difference between revisions

Content deleted Content added
List of new generic OO languages complete
Very minor spelling correction
Line 1:
In [[computer science]], '''generics''' areis a technique that allows one value to take different [[datatype]]s (so-called [[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.