Skip to content

Instantly share code, notes, and snippets.

@kirasiris
Created January 29, 2020 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirasiris/1841545d1ad079ee25cbd94360728b77 to your computer and use it in GitHub Desktop.
Save kirasiris/1841545d1ad079ee25cbd94360728b77 to your computer and use it in GitHub Desktop.
An example on creating Overloading in C#
using static System.Console;
namespace FourthConsoleApplicationUnitMethods
{
class UnitMethods {
// Method Overloading
static int Add(int a, int b) {
int result = a + b;
return result;
}
static double Add(double a, double b) {
double result = a + b;
return result;
}
static void Main(string[] args) {
int resultInt = Add(5,10);
double resultDouble = Add(10.00, 20.00);
WriteLine("The integer addition is: " + resultInt);
WriteLine("The double addition is: " + resultDouble);
ReadLine();
}
}
}
@kirasiris
Copy link
Author

It consist of passing different data types into the parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment