且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#:抽象类需要实现接口?

更新时间:2022-06-09 01:44:51

在C#中,你仍然定义方法,但你没有提供一个身体,你把它标记为抽象的。像这样:

In C# you still define the methods, but you don't provide a body and you mark it as abstract. Like so:

interface IFoo
{
    void Bar();
}

abstract class Foo : IFoo
{
    public abstract void Bar();
}