C# and method hiding

后端 未结 9 1186
悲&欢浪女
悲&欢浪女 2021-01-03 07:48

Per MSDN, the \"new\" keyword when used for method hiding only suppresses a warning.

http://msdn.microsoft.com/en-us/library/435f1dw2.aspx

Do I really need

9条回答
  •  执念已碎
    2021-01-03 08:19

    The use of new is when you want a function of the same name, but you don't want to override. It breaks the virtual dispatch chain.

    This might happen when somebody adds a function to a base class that has the same name as your derived class function.

提交回复
热议问题