在C#中解释有关抽象类和接口的实时示例? [英] Explain real-time example about abstract class and interface in C#?

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

问题描述

解释有关C#中抽象类和接口的实时示例?



我尝试过:



没什么。

Explain real-time example about Abstract class and Interface in C#?

What I have tried:

Nothing.

推荐答案

你可以找到一个不太精心设计的谷歌搜索的实时解释。说真的。



但是,因为这应该是一个真正的答案,这里有一些花絮:



接口不能实现方法(它只能指定方法原型)或指定可访问性,但是抽象类可以(并且它的抽象方法必须是 protected public )。



另一个关键区别是另一个类只能从ONE类继承(抽象或其他),但可以继承来自多个界面。



现在,去学习如何使用谷歌进行更深入的讨论。
You can find a "real time explanation" with a not too well-crafted google search. Seriously.

However, since this is supposed to be an actual answer, here are some tidbits:

An interface cannot implement methods (it can only specify the method prototypes) or specify accessibility, but an abstract class can (and its abstract methods must be protected or public).

Another key difference is that another class can only inherit from ONE class (abstract or otherwise), but can inherit from multiple interfaces.

Now, go learn how to use google for a more in-depth discussion.


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

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