Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SampleClass sc   = new SampleClass();
        IControl    ctrl = (IControl)sc;
        ISurface    srfc = (ISurface)sc;

        // The following lines all call the same method.
        sc.Paint();
        ctrl.Paint();
        srfc.Paint();

        sc.Fly();
        ctrl.Eat();
        sc.Eat();
        sc.Hit();
    }