Abstract method vs Virtual method

Abstract method Virtual method
1) Abstract method doesn’t have any body defined. 1) Virtual method have their body defined otherwise it will give compile-time error message “<VirtualMethod()> must declare body because it is not defined abstract, extern, or partial.
2) Mandatory to implement them. 2) Not mandatory to override them.
3) They can be defined in abstract classes only. 3) They can be defined in any instance class.
Advertisements

Leave a comment

Filed under .Net, C#

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s