.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 >> .NET Framework >> Post New Question Subscribe to Interview Questions

What is the meaning of virtual keyword?

Posted By :Maverick     Posted Date :July 31, 2011    Points :40   Category :.NET Framework 
It means that the method and the properties can be overriden.

You can also find related Interview Question to What is the meaning of virtual keyword?  below: 

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

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

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

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

What is web application virtual directory?

  
A virtual directory appears to client browsers as though it were
contained in a Web server's root directory, even though it can physically Reside somewhere else. (More...)

Yield keyword in C Sharp

  
C Sharp and yield keyword

Hi,



One of the cool and yet most unknown feature of the C# is the yield keyword. The yield keyword is used in an iterator block to provide a value to the enumerator object or to signal the end of the iteration. When used the expression is evaluated and returned as a value to the enumerator object. Note the expression has to be implicitebly convertible to yield type of the iterator. Here is an example



public static IEnumerable GetIntCollectionFromString(string SomeString){ string[] val = SomeString.Split(' '); int intToAdd; foreach (string token in val) { if (int.TryParse(token, out intVal)) { yield return intVal; } else { yield break; } }}

Here since we are using the yield keyword the function will return the collection of intVal instead of the value of intVal. The statement will only return when the iteration of the loop is complete.



There are some limitation with the yield keywords.

Unsafe blocks are not allowed
Parameters to the method, operator, or accessor cannot be ref or out. (More...)

Explain Virtual Function in C#.

  
Virtual functions implement the concept of polymorphism are the same as in C#, except that you use the override keyword with the virtual function implementaion in the child class.

The parent class uses the same virtual keyword. Every class that overrides the virtual method will use the override keyword.


class Shape{
public virtual void Draw()
{ Console.WriteLine("Shape.Draw") ; }
}
class Rectangle : Shape{
public override void Draw()
{ Console.WriteLine("Rectangle.Draw"); }
} (More...)

What are virtual path providers?

  
Its the path providing facility to provide the virtual content to compiler. For example, a virtual path provider provides a means to supply content from locations other than the file system.

To attain the same following step(s) are required :
1. Create a VirtualPathProvider class, and implement all the required methods to handle files and folder requests.

2. Register the virtual path provider to let the ASP.NET hosting environment know where the content will be served from.

3. Create VirtualFile and VirtualDirectory objects to stream the content.


For more details, visit http://support.microsoft.com/kb/910441 (More...)

What are the differences between web part page gallery, site gallery,Virtual server gallery and online gallery in SharePoint?

  
Web Part Page Gallery in SharePoint is the default gallery provided by Microsoft that comes installed with SharePoint. Site Gallery is specific to one sharepoint website site. Virtual Server gallery is specific to that virtual server and online gallery is available for download web parts from MSDN. (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