Skip to main content

Posts

Showing posts with the label Method Overloading and Overriding in C#

Method Overloading and Overriding in C# Explained

Method Overloading and Overriding in C#   Method Overloading Method Overloading  means defining multiple  methods  with the same name but with different parameters. By using  Method Overloading , we can perform different tasks with the same method name by passing different parameters.   Suppose, if we want to overload a method in c#, then we need to define another method with the same name but with different signatures. Method Overloading is also called as  compile time polymorphism  or  early binding .   Below is the code snippet for implementing a method overloading in C#.        public class Calculate     {         public void AddNumbers( int a, int b)         {             Console.WriteLine( $" {a} + {b} = { a + b} " );   ...