VB.NET 中的“阴影"与“覆盖" [英] '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?
推荐答案
我不认为 Shadows 真的是一个 OOP 概念.Overrides 表示您正在为在祖先类中声明的方法/属性等提供新的或附加的功能.Shadows 确实让编译器认为父方法/属性等根本不存在.
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.
我对阴影没有用.坚持覆盖.VB 多年来提供的这些有用的小功能"总是在某些时候让您感到悲伤.
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.
这篇关于VB.NET 中的“阴影"与“覆盖"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!