- Downcasting
-
In object-oriented programming, downcasting or type refinement is the act of casting a reference of a base class to one of its derived classes.
In most programming languages, it is usually possible to check through RTTI whether the type of the referenced object is indeed the one being cast to or a derived type of it, and thus issue an error if it is not the case.
See also
- Subtype polymorphism
External links
- Article "Downcasting is a Code Smell" by Jeremy D. Miller
- Article "A downcasting tragedy" by Jimmy Bogard
- Article "Prefer polymorphism over instanceof and downcasting" by Bill Venners
- Article "Downcasting in C#" by Scott Lysle
- Paper "Multiple downcasting techniques"
Categories:
Wikimedia Foundation. 2010.