Summary
polymorphism means one interface, many forms. A single call can select different implementations. Two main kinds:
compile_time_polymorphism and
runtime_polymorphism. Compile time uses
function_overloading,
operator_overloading, and
generics/
templates. Runtime uses
method_overriding,
interfaces, and
dynamic_dispatch. In a
class_hierarchy, a
common_interface enables polymorphic_calls. It allows
substitution where a
base_class_reference points to a
derived_instance. Many languages support it with
virtual_functions or
protocols. Remember:
same_message_different_behavior and improved
code_reuse,
flexibility,
extensibility.