DynamicVSStaticPolymorphism - GerdHirsch/Cpp-TemplateBasics GitHub Wiki

About this Example

The design represents a general design for components.
A concrete component that can be considered and tested on its own.
The component depends only on abstractions
that represent the required environment of the component.

In this example, we assume a concrete component
that is responsible for one thing in the sense of the Single Responsibility Principle and delegates everything else to its environment.

Polymorphism

Polymorphism is based on abstractions.
Collaboration is always based on a contract (design by contract).
The design has the Open Closed Principle OCP as its goal.
This means that the component can be used in different environments without having to be changed

next Dynamic Polymorphism

Static Polymorphism

Dynamisation of Static Polymorphism