What are the different ways of overloading methods in C#? What is function overloading in C#?
Before knowing the different methods of overloading in C#, lets first clear out what exactly
overloading is. Overloading is the OOPs concept of using a method or a class in different
styles by modifying the signature of the parameters in it. To know more on overloading,
In order to achieve overloading, there may be several techniques applied. There are different types
of overloading like Operator Overloading, Function Overloading etc.
Function overloading may be achieved by changing the order of parameters in a function, by
changing the types passed in the function, and also by changing the number of parameters
passed in a function. See code sample below to see types of overloading.
Default Values of Types
Const - ReadOnly
Interface Reference, is, as
//Define a method below
public void fnProcess(int x, double y)
//change the order of parameters
public void fnProcess(double x, int y)
//.......Some code in C#
//Similarly, we may change the number of parameters in fnProcess
//and alter its behaviour
More Interview Questions...