Polymorphism
Revision as of 19:04, 16 December 2016 by QuantumFluctuator (talk | contribs)
Polymorphism is the term used to describe one method being able to take more than one type of input to process its code. <syntaxhighlight lang="csharp" line>public static void Main(string[] args)
{ int x = divide(15, 4); double y = divide(2.5, 0.5); Console.WriteLine(x); Console.WriteLine(y); Console.ReadLine(); /* writes: * 3 * 5.0 */ }
public static double divide(double a, double b)
{ return a / b; }
public static int divide(int a, int b)
{ return a / b; }