What is polymorphism?
Answers
Answer:
polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types.
The most commonly recognised major classes of polymorphism are:
Ad hoc polymorphism: defines a common interface for an arbitrary set of individually specified types.
Parametric polymorphism: when one or more types are not specified by name but by abstract symbols that can represent any type.
Subtyping (also called subtype polymorphism or inclusion polymorphism): when a name denotes instances of many different classes related by some common superclass.
History
Interest in polymorphic type systems developed significantly in the 1960s, with practical implementations beginning to appear by the end of the decade. Ad hoc polymorphism and parametric polymorphism were originally described in Christopher Strachey's Fundamental Concepts in Programming Languages, where they are listed as "the two main classes" of polymorphism. Ad hoc polymorphism was a feature of Algol 68, while parametric polymorphism was the core feature of ML's type system.
In a 1985 paper, Peter Wegner and Luca Cardelli introduced the term inclusion polymorphism to model subtypes and inheritance, citing Simula as the first programming language to implement it.
Answer:
Polymorphism: A phenomenon in which when a single substance crystallises in two or more forms under different conditions of solidification is called polymorphism and the substance is called polymorphous. For example, calcite and oragonite are two forms of CaCO.