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  >  Tech FAQs  >  OOPS

 Print  |  
Question:  what is shadowing in .net?



January 01, 2006 05:25:12 #2
 Sameeksha Microsoft Expert  Member Since: October 2005    Total Comments: 231 

RE: what is shadowing in .net?
 

Shadowing is either through scope or through inheritance.

Shadowing through inheritance is hiding a method of a base class and providing a new implementation for the same. This is the default when a derived class writes an implementation of a method of base class which is not declared as overridable in the base class. This also serves the purpose of protecting an implementation of a new method against subsequent addition of a method with the same name in the base class.

'shadows' keyword is recommended although not necessary since it is the default.

     

 

Back To Question