What is the use of virtual, sealed, override, and abstract?

 Posted by Tripati_tutu on 12/22/2010 | Category: C# Interview questions | Views: 8189 | Points: 40

• The use of virtual keyword is to enable or to allow a class to be overridden in the derived class.
• The use of sealed keyword is to prevent the class from overridden i.e. you can’t inherit sealed classes.
• The use of override keyword is to override the virtual method in the derived class.
• The use of abstract keyword is to modify the class, method, and property declaration. You cannot directly make calls to an abstract method and you cannot instantiate an abstract class.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response