L
Laura Stern
Guest
Actually, this is the correct behavior. The compiler only knows that OkButton is an IButton as that's how it's defined. An IButton cannot be cast to a Control. You can cast a Button to a Control because it has all the methods and and properties that Control has. But an IButton does not have any of those. But at runtime the instance you get is an actual button which is a Conrol. The DYNAMIC-CAST is basing the cast on that, i.e., what the instance actually is not on how it's defined.
Continue reading...
Continue reading...