- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference between Method Overriding and Method Hiding in C#
In C# there are two mechanisms for redefining or providing the new implementation of a method of parent class by its child class and these two mechanisms are known as Method overriding and Method hiding. Now on the basis of how method re-implementation is done we can distinguish between both of them.
Following are the important differences between Method Overriding and Method Hiding.
Sr. No. | Key | Method Overriding | Method Hiding |
---|---|---|---|
1 | Definition | Method Overriding is a mechanism to achieve polymorphism where the super class and sub class have same methods, including the parameters and signature and, when you call it using the sub class object, the implementation in the subclass is invoked. | On other hand Method Hiding can be defined as technique in which user can redefine the method of base or parent class using new keyword which results in hiding the main basic implementation provided by base class of that particular method. |
2 | Access of Parent implementation | In Method Overriding child class can access parent class method implementation. | In case of Method Hiding parent class method implementation cannot be accessed through child class reference. |
3 | Modifier Used | For Method overriding override keyword is being used. | In case of Method Hiding new keyword is used to define new implementation in child class. |
4 | Implementation type | In Method Overriding the implementation type of the method is of object type. | However on other hand implementation type of method in Method hiding is of reference type. |
5 | Parent to child reference | In Method Overriding when parent class reference variable is pointing to the object of the child class, then it will call the overridden method in the child class. | On the other hand in Method Hiding, when parent class reference variable is pointing to the object of the child class, then it will call the hidden method in the parent class. |
6 | Usage | Method Overriding only redefines the implementation of the method. | Method Hiding can completely redefine the method. |
- Related Articles
- What is the difference between method hiding and method overriding in Java?
- What is the difference between function overriding and method hiding in C#?
- What is the difference between overriding and hiding in C#?
- What is the difference between method overloading and method hiding in Java?
- What is the difference between method overloading and method overriding in Java?
- What is method hiding in C#?
- Difference Between Function Overloading and Overriding in C++
- Difference between == and .Equals method in c#
- Difference between Method and Function in C#
- Method Overriding in Perl
- Method overriding in Java
- Method overloading v/s method overriding in Java
- Difference Between Abstraction and Data Hiding
- Difference Between Data Hiding and Encapsulation
- Method Overriding in Dart Programming

Advertisements