Use of virtual, sealed, override, and abstract - C#.NET

Explain the use of virtual, sealed, override, and abstract.

The virtual keyword enables a class to be overridden. If it has to be prevented from being overridden, then the sealed keyword needs to be used. If the keyword virtual is not used, members of the class can even then be overridden. However, its usage is advised for making the code meaningful.

The override keyword is used to override the virtual method in the base class. Abstract keyword is used to modify a class, method or property declaration. You cannot instantiate an abstract class or make calls to an abstract method directly.

An abstract virtual method means that the definition of the method needs to be given in the derived class.
What benefit do you get from using a Primary Interop Assembly (PIA? - C#.NET
What benefit do you get from using a Primary Interop Assembly (PIA)? - A primary interop assembly contains type definitions (as metadata) of types implemented with COM...
Use of static members with example using C#.NET.
Explain the use of static members with example using C#.NET - Static members are not associated with a particular instance of any class.
How to achieve polymorphism in C#?
How to achieve polymorphism in C#.NET? - Polymorphism is when a class can be used as more than one type through inheritance....
Post your comment
Discussion Board
Virtual
"If the keyword virtual is not used, members of the class can even then be overridden. However, its usage is advised for making the code meaningful"

I don't really understand how this could be achieved (unless you use 'new' keyword, but that would be hiding the base implementation). You need to mark members as virtual to indicate the compiler that it could be overridden.
Mangesh 06-3-2012