0

How is method hiding is different than method overriding in c#

31st Mar 2018, 8:12 AM
Akshay Karande
1 Answer
+ 2
Method Overriding. It means that you are invoking a method from the base class and the derived class at the same time. Use virtual keywords to indicates that method can be overriden by the derived/inherited classes. And use override keyword to allow the derived class to override a method in the base class. We use method overriding to modify the methods behavior. Method hiding is a technique where you encapsulate a method on a specific class so that it cannot be exposed directly on the real-world and with the help of access modifiers you can determine where you can only access a method. In c# we have 5 access modifiers. We have public, private, protected, internal and protected internal.
2nd Jun 2018, 8:54 AM
Rencil Justin Evangelista
Rencil Justin Evangelista - avatar