CSharp examples for Custom Type:overload
You can have multiple definitions for the same function name in the same scope.
The function must differ from each other by the types and/or the number of arguments in the argument list.
You cannot overload function that differ only in return type.
using System;//from w w w . j a v a2 s . com class Printdata { void print(int i) { Console.WriteLine("Printing int: {0}", i ); } void print(double f) { Console.WriteLine("Printing float: {0}" , f); } void print(string s) { Console.WriteLine("Printing string: {0}", s); } static void Main(string[] args) { Printdata p = new Printdata(); p.print(5); p.print(500.263); p.print("Hello C++"); } }