Function Overloading

Function overloading is a concept of writing more than one function with the same name and with different types of arguments.


Proto typepossible to overload
Public void Print ()1 & 2  Not possible
Private Void Print ()1 & 3 Not possible
Public int Print () 1& 4 Yes
Public void Print (Int x) 4 & 5 NO
Public void Print (int y) 4 & 6   Yes 
Public void Print (ref int x)4 & 7  Yes
Public Void Print  (out int x) 6 & 7 No
Public void Print  () 1 &8  Yes [Not overloading concept]

 These core tutorials will help you to learn the fundamentals of .NET. For an in-depth understanding and practical experience, explore Online ".NET Training".

Example on function overloading

Open Window forms Application Project Place a Button Code in GD

 Class Test


Public void print ( float x)


Message. Box. Show (“From float :” + X);


Public void Print (double X)


Message. Box. Show (“From double:” + X);


Public void Print (decimal X)


Message. Box. Show (“From decimal:” + X);



//test Code for button1_click Test t = new Test ();

Print (4.0) ;//

//t. Print (4); error

Print (4f);//float

Print (4m);//decimal

Print (4d);//double