What's the Practical usage of new (modifier) functions?
Asked
Active
Viewed 534 times
1
-
I think you are talking about C#. Do rephrase to indicate the language. – Naveen Jul 07 '09 at 09:04
-
Here's my article on the subject. http://blogs.msdn.com/ericlippert/archive/2008/05/21/method-hiding-apologia.aspx – Eric Lippert Jul 07 '09 at 15:05
3 Answers
2
It's an attempt to work around an aspect of the fragile base class problem.

Pete Kirkham
- 48,893
- 5
- 92
- 171
1
The new modifier in C# allows you to redefine a method in a subclass hiding the base class method.
I would mainly use it for modifying a non-virtual method in a subclass.

Patrick McDonald
- 64,141
- 14
- 108
- 120
1
The use of new is when you want a function of the same name, but you don't want to override. It is identical to the reintroduce keyword in Delphi.

James
- 80,725
- 18
- 167
- 237