static void Use() { EditBox editbox = new EditBox(); editbox.Paint(); // error: no such method IControl control = editbox; control.Paint(); // calls EditBox抯 Paint implementation }
static void UsageTwo() { object obj = new EditBox(); IControl control = (IControl)obj; IDataBound dataBound = (IDataBound)obj; }
static void UsageOne() { EditBox editBox = new EditBox(); IControl control = editBox; IDataBound dataBound = editBox; }