Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is difference between method overriding and method hiding in c#, explain with example?

user-image
Question added by Mukhtar Ahmad
Date Posted: 2014/08/20
Zubair Ali
by Zubair Ali , Software Developer III , S&P Global

Common thing is that you create a method with same signature in Base and the child class. but both have a distinction of Keyword Virtual and Override used with Base class and the child one respectively.If you just write a method in base class and in the child also with the same name then it is an example of method hiding. but if you make your method virtual in base class and override it in child class with DISTINCT implementation in child then its an example of Method Overriding. 

Dileep DK
by Dileep DK , Group Manager and Solutions Architect , UST Global

Overriding and hiding are very similar but the differences are in the scope. When overriding you still get to access the base methods whereas while hiding you have to implement all methods.

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.