| using System;
public class FunctionDemo {
public static void Main (){
Overloading();
}
public static void F(int p){
Console.WriteLine("This is F(int) on {0}", p);
}
public static void F(double p){
Console.WriteLine("This is F(double) on {0}", p);
}
public static void F(double p, bool q){
Console.WriteLine("This is F(double,bool) on {0}, {1}", p, q);
}
public static void F(ref int p){
Console.WriteLine("This is F(ref int) on {0}", p);
}
public static void Overloading(){
int i = 7;
F(i); // This is F(int) on 7
F(5.0); // This is F(double) on 5
F(5.0, false); // This is F(double,bool) on 5, False
F(ref i); // This is F(ref int) on 7
}
} |