Conceptual
Login

Generic Types

Type parameters let one definition of a function or data structure work over many concrete types, with the compiler checking each instantiation. Constraints (bounds) state what operations the parameter must support.

Questions this Concept answers

  • Why is one generic container preferred over a separate hand-copied container for each element type?