Is there any difference b/w baseclass method hiding (using new) and overriding virtual methods??
Using the new keyword we are hiding the base methods implementation. using override we are overriding the base class method with a new implementation in derived class.
For me both looks like the same. i dont feel any difference.
Class Baseclass
{
public void mymethod()
{
my implementation
}
}
Class Derived : BaseClass
{
new public void mymethod()
{
my new implemetation
}
}
if i want to access base calss method, i can use BaseClass.mymethod() . if i want to access the new implementation i can use Derived.mymethod().
using the new, i am giving the new implementation to the same method instead of overriding.
here what is the difference b/w new and override??

Danatas GerviPosted Aug 31, 2009, 8:33 AM
Yes.
The benefit of overriding – this is ability to call derived class method, when the instanse is getted as base class.
Basically, if somebody had written the code (in child class) – this code is useful. :-)
So when any program(algorithm) gets something, it wand to use latest version of code, most adequate… typicaly this exist in child class.
In case of hiding – not overrided code of base class will be called.