What is The Use of Method Hiding In C# although we having method overriding ? [Resolved]

Posted by Kasani007 under C# on 1/12/2017 | Points: 10 | Views : 484 | Status : [Member] | Replies : 1
What is The Use of Method Hiding In C# although we having method overriding ?




Responses

Posted by: Sheonarayan on: 1/12/2017 [Administrator] HonoraryPlatinum | Points: 50

Up
0
Down

Resolved
Method hiding as the name suggest, hides the parent class method but doesn't override it (replace it). This means that if you create the instance of child class and cast to parent class and call that method you can call parent class method.

So method hiding simply is creating a new version of the method keeping the existing one in the parent method. Overriding is completely replacing the current method and declaring a fresh method.

Read more about this http://www.dotnetfunda.com/forums/show/16965/what-is-difference-between-method-hiding-and-shadowing-in-csharp.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response