在c#中比较抽象类和接口 [英] Comparing Abstract class with Interface in c#

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

问题描述

为什么我们将抽象类与接口进行比较?应该将抽象类与Sealed类进行比较,而不是使用Interface。如果我错了,请各位纠正我吗?



非常感谢提前!!!

Why we compare abstract class with interface? Abstract class supposed to be compare with Sealed class not with Interface. Please guys correct me if I m wrong?

Many thanks in advance !!!

推荐答案

In 抽象类和接口都为从它们继承的类提供了一个模板。



我不明白为什么要将抽象类与密封类进行比较:您不能从Sealed类继承,并且Abstract Class的主要用途是指定和/或提供继承类的功能。
In a sense both 'Abstract Classes and Interfaces provide a template for Classes that inherit from them.

I don't see why you would compare an Abstract Class with a Sealed Class: you cannot inherit from a Sealed Class, and the major use of an Abstract Class is to specify and-or provide functionality for inheriting Classes.


实际上,将Abstract类与Interface进行比较更有意义而不是将其与密封版本进行比较。

抽象类和接口可以起到类似的作用,而密封类与机器人抽象类和接口有点对立。
Actually, comparing Abstract class with Interface makes more sense than comparing it with a Sealed one.
Abstract class and an Interface could serve similar purposes, while Sealed class is somewhat antithetic to bot Abstract class and Interface.


plase go throw

http://www.dotnetbull .com / 2011/11 / distinct-between-abstract-class-and.html

此链接
plase go throw
http://www.dotnetbull.com/2011/11/difference-between-abstract-class-and.html
this link


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

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