Invalid dynamic cast.
#2169 Compile-time error
Invalid dynamic cast.
Additional Information
The type 'X' preceding the cast
operator is not a user-defined type.
The expression following the cast
operator must be of a user-defined type.
The target type 'X' does not extend the static type 'Y' of the expression following the cast
operator.
Explanation
The type on the left-hand side of the cast
operator must be
a subtype of the static type of the expression on its right-hand side,
otherwise it cannot succeed at run-time.