Paradigm: Generic

Generic programming is a style in which algorithms are written in terms of abstract data types; when the algorithm needs to be used for specific data types, it is instantiated with these types passed as parameters. This style allows to use universal code for similar tasks which operate with different data types and thus reduce code duplication.

Generic programming is widely used to implement universal containers and algorithms. Thus, C++ standard template library (STL) provides a set of containers like dynamic array, linked list, queue, set, associative array etc. and algorithms which can be applied to these or user-defined containers.

Generic programming is a kind of metaprogramming.

Programming languages that support this paradigm: