Computer Science, asked by roysompa8104, 1 year ago

Difference between overloading and overriding in c# with example

Answers

Answered by Raghuroxx
0

Answer:-

Following are the difference between Method Overloading and Method Overriding:-

1. Creating more than one method or function having same name but different signatures or the parameters in the same class is called method overloading. Creating a method in the derived class with the same signature as a method in the base class is called as method overriding

2. It is called the compile time polymorphism It is called runtime polymorphism

3. It has the same method name but with different signatures or the parameters It must have same method name as well as the signatures or the parameters.

4. Method overloading doesn’t need inheritance Mehod overriding needs inheritance

5. Method overloading is possible in single class only Method overriding needs hierachy level of the classes i.e. one parent class and other child class.

6. Access modifier can be any Access modifier must be public.

7. Method overloading is also called early binding. Method overriding is also called late binding.

Similar questions