.netvb.netoopoverridingshadows

'Shadows' vs. 'Overrides' in VB.NET


What is the significance of the two keywords Shadows and Overrides? What they do and for which context is one or the other preferable?


Solution

  • I wouldn't consider Shadows to really be an OOP concept. Overrides indicates that you are providing new or additional functionality for a method/property etc that was declared in an ancestor class. Shadows really tricks the compiler into thinking that the parent method/property etc does not even exist.

    I have no use for Shadows. Stick to Overrides. These types of helpful little "features" that VB has provided for years always end up causing you grief at some point.