Klassenswitch
Klassenswitch is a concept in object-oriented programming that describes the ability to change an object's class at runtime in order to alter its behavior. The term, a German construction meaning “class switch,” appears in discussions of dynamic languages and metaprogramming where the type or role of an object can be modified without creating a new instance.
In practice, Klassenswitch is not a standard feature of most statically typed languages. In languages with
Use cases include runtime feature toggles, A/B testing of object behavior, or modelling entities that assume
Limitations and considerations are significant. Changing an object’s class or behavior at runtime can introduce complexity,
See also: dynamic dispatch, metaprogramming, State pattern, Strategy pattern, mixins, object composition.