Skip to content

Instantly share code, notes, and snippets.

@YannMjl
Last active June 9, 2018 19:02
Show Gist options
  • Save YannMjl/bd4733b76e579d512b0dc684e109e2f6 to your computer and use it in GitHub Desktop.
Save YannMjl/bd4733b76e579d512b0dc684e109e2f6 to your computer and use it in GitHub Desktop.
Polymorphism: overloading example
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