Created
January 29, 2020 02:20
-
-
Save kirasiris/1841545d1ad079ee25cbd94360728b77 to your computer and use it in GitHub Desktop.
An example on creating Overloading in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It consist of passing different data types into the parameters.