抽象方法与之间的区别虚方法 [英] difference between an abstract method & virtual method

查看:89
本文介绍了抽象方法与之间的区别虚方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抽象方法和虚拟方法之间的差异

用一个例子解释

difference between an abstract method & virtual method
Explain withe one example

推荐答案

这个问题在这个问题上的回答是多么容易网络,以及你说这个的方式(作为一个需求,需要一个例子),我认为这是你的功课。阅读你的文章,做自己的功课。
GIven how easy this question is to answer on the web, and the way you word this ( as a demand, with a requirement for an example ), I assume this is your homework. Read your texts, and do your own homework.


抽象方法是那些没有定义的方法。意味着如果你的方法没有它的主体它是抽象的。



另一方面,如果你已经定义了主体并希望派生的类可以覆盖它成员,如果愿意,可以将其定义为虚拟。



相当于这些关键字的VB.NET提供了清晰的知识:



abstract == MustOverride

虚拟== 可覆盖



我希望你得到答案。



干杯

:thumbsup:
Abstract method are those which are not defined. Means if your method doesnt have its body it is abstract.

On the other hand, if you have already defined the body and want the classes that derives it can override its member, if they wish, you define it as virtual.

The VB.NET equivalent to these keywords gives a clear knowledge on this :

abstract == MustOverride
virtual == Overridable

I hope you got your answer.

Cheers
:thumbsup:


C#语言文档( MSDN )中,您可以找到所需的一切。

例如,您可以在虚拟方法中找到信息和示例抽象方法

:))
In the C# language documentation (MSDN) you may find all that you need.
For instance, you may find info and examples in "Virtual methods" and "Abstract methods".
:)


这篇关于抽象方法与之间的区别虚方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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