C#中的抽象类和接口类有什么不同? [英] What is different between an abstract and an Interface class in C#?

查看:190
本文介绍了C#中的抽象类和接口类有什么不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C#中的抽象类和接口类之间有什么不同?

What is different between an abstract and an Interface class in C#?

推荐答案

接口不是类,只是合同定义了必须类实现的公共成员。

An interface is not a class, it is just a contract that defines the public members that a class must implement.

抽象类只是无法创建实例的类。通常,您可以使用它来定义一个基类,为派生的类定义一些虚拟方法。

An abstract class is just a class from which you cannot create an instance. Normally you would use it to define a base class that defines some virtual methods for derived classes to implement.

这篇关于C#中的抽象类和接口类有什么不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆