Last active
June 9, 2018 19:02
-
-
Save YannMjl/bd4733b76e579d512b0dc684e109e2f6 to your computer and use it in GitHub Desktop.
Polymorphism: overloading example
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 System; | |
namespace polymorphismExample | |
{ | |
public class Numbers | |
{ | |
public void addition(int a, int b) | |
{ | |
Console.WriteLine(a + b); | |
} | |
public void addition(int a, int b, int c) | |
{ | |
Console.WriteLine(a + b + c ); | |
} | |
} | |
public class Display | |
{ | |
static void Main(string[] args) | |
{ | |
Numbers obj = new Numbers(); | |
obj.addition(3, 7); | |
obj.addition(9, 4, 2); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment