代码之家  ›  专栏  ›  技术社区  ›  Tofik

这是什么意思,怎么称呼?类MyClass:something,something2{…}[关闭]

  •  0
  • Tofik  · 技术社区  · 8 年前

    我来过这几次,但我不知道它是怎么叫的,也不知道它是什么,它是做什么的。

    class MyClass : something, something2{ ... }
    

    你能告诉我正确的方向吗?一些文件等。

    谢谢。

    1 回复  |  直到 8 年前
        1
  •  2
  •   ikkentim    8 年前

    给出这个示例场景:

    interface IComponent
    {
        void DoStuff();
    }
    
    interface ITitledComponent : IComponent
    {
        string Title { get; }
    }
    
    abstract class ComponentBase : IComponent
    {
        public void DoStuff()
        {
            throw new NotImplementedException();
        }
    }
    
    class MyComponent : ComponentBase, ITitledComponent
    {
        public string Title => throw new NotImplementedException();
    }
    

    线路 class MyComponent : ComponentBase, ITitledComponent 是说,这个班 MyComponent 必须 继承类 ComponentBase 并实现接口 ITitledComponent 所有的内部定义。

    推荐文章