Downcast will fail. : Object Cast « Class Interface « C# / C Sharp
- C# / C Sharp
- Class Interface
- Object Cast
Downcast will fail.
class Employee { }
class ContractEmployee : Employee { }
class CastExample3
{
public static void Main ()
{
ContractEmployee ce = (ContractEmployee)new Employee();
}
}
Related examples in the same category