GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Microsoft  >  ASP.NET

 Print  |  
Question:  Virtual function in c#

Answer: explain virtual function in c# with an example


September 09, 2009 05:22:38 #4
 kirangiet   Member Since: June 2009    Total Comments: 24 

RE: Virtual function in c#
 
Some Facts about Virtual Keyword

1)It is not compulsury to mark the derived/child class function with Override KeyWord while base/parent class contains a virtual method
2)Instead of Virtual we can use New Keyword
3)We will get a warning if we won't use Virtual/New keyword.
4)At the end its all depends which class object we are creating and assigned to which  class reference.

Finally we are using virtual/new just for the sake of compiler.

Trust me write the code your self and test then you won't disagree.
     

 

Back To Question