.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> C# >> Post New Question Subscribe to Interview Questions

What is use of Virtual,sealed,override,abstract keyword?

Posted By :Narayanan     Posted Date :January 16, 2013    Points :40   Category :C# 
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.

You can also find related Interview Question to What is use of Virtual,sealed,override,abstract keyword?  below: 

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

  
. 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 (More...)

Can you override private virtual methods in .NET Framework?

  
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access. (More...)

What is the keyword used in VB to carry out the work of virtual keyword of C#?

  
The Overridable keyword. It declare a method to support polymorphism. (More...)

To define abstract class in VB which keyword is used?

  
MustInherit keyword is used to create an abstract class in VB. (More...)

To define abstract method which keyword is used in VB?

  
MustOverride keyword is used to define an abstract method in VB. (More...)

Expalin one difference between Abstract and virtual methods?

  
Virtual method can be overriden in any of its derived class and abstract method must be overriden in any of the non abstract class. (More...)

What is the meaning of virtual keyword?

  
It means that the method and the properties can be overriden. (More...)

All about Virtual Keyword

  
When we need to override a method of the base class in the sub class, then we give the virtual keyword in the base class method. This makes the method in the base class to be overridable.

· Methods, properties, and indexers can be virtual, which means that their implementation can be overridden in derived classes.

· You cannot use the virtual modifier with the following modifiers: Static, Abstract, Override (More...)

Is it possible to modify an abstract class with sealed Modifier?

  
no, Because the two modifier have opposite meanings. (More...)

Can you override private virtual methods?

  
No, private methods are not accessible outside the class. (More...)

What is Method Overriding? How to override a function in C#?

  
Use the override modifier to modify a method, a property, an indexer, or an event. An override method provides a new implementation of a member inherited from a base class. The method overridden by an override declaration is known as the overridden base method. The overridden base method must have the same signature as the override method.
You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend