static void Use()
        {
            EditBox editbox = new EditBox();

            editbox.Paint();    // error: no such method
            IControl control = editbox;

            control.Paint();    // calls EditBox抯 Paint implementation
        }
示例#2
0
 static void UsageTwo()
 {
     object obj = new EditBox();
     IControl control = (IControl)obj;
     IDataBound dataBound = (IDataBound)obj;
 }
示例#3
0
 static void UsageOne()
 {
     EditBox editBox = new EditBox();
     IControl control = editBox;
     IDataBound dataBound = editBox;
 }
示例#4
0
 static void UsageTwo()
 {
     object     obj       = new EditBox();
     IControl   control   = (IControl)obj;
     IDataBound dataBound = (IDataBound)obj;
 }
示例#5
0
 static void UsageOne()
 {
     EditBox    editBox   = new EditBox();
     IControl   control   = editBox;
     IDataBound dataBound = editBox;
 }