Saturday, 1 October 2011

What is shadowing?

                 When two elements in a program have same name, one of them can hide and shadow the other one. So in such cases the element which shadowed the main element is referenced

 

  What is the difference between Shadowing and Overriding?
Following are the differences between shadowing and overriding:
  Overriding redefines only the implementation while shadowing redefines the whole element.
  In overriding derived classes can refer the parent class element by using "Me" ("this" in C#) keyword, but in shadowing you can access it by "MyBase" ("base" in C#).

No comments:

Post a Comment