C# new in method declaration
public new int AdjustedBaseValue
What does the new here me开发者_Go百科an or do?
It means you are shadowing the int value. It is declared in a base class and you are re-declaring it in a derived class, effectively hiding the base class version.
See documentation here for more information.
Refer example here
In this case, new
is a modifier that hides an inherited member from the base class. See the documentation.
Here is a good forum post with some examples between the differences of using new
vs override
http://social.msdn.microsoft.com/Forums/en/Vsexpressvcs/thread/65e02299-300f-4b74-8f0a-679f490605f5
New is to hiding the baseclass implementation. Stoping the polymorphism...
精彩评论