Inheritance from both class and interface : Interface hierarchy « Class « C# / CSharp Tutorial






using System;

public class Control {
    public void Serialize() {
        Console.WriteLine("Control.Serialize called");
    }
}

public interface IDataBound {
    void Serialize();
}

public class EditBox : Control, IDataBound {
}

class InterfaceInh2App {
    public static void Main() {
        EditBox edit = new EditBox();

        IDataBound bound = edit as IDataBound;
        if (bound != null) {
            Console.WriteLine("IDataBound is supported...");
            bound.Serialize();
        } else {
            Console.WriteLine("IDataBound is NOT supported...");
        }
    }
}








7.33.Interface hierarchy
7.33.1.Interfaces Based on Interfaces
7.33.2.Interface Inheritance Demo
7.33.3.Interfaces Inheriting Interfaces
7.33.4.One interface can inherit another.
7.33.5.Inheritance from both class and interface