Maybe my question will be weird. I have this snippet :
public class Class1
{
public static void Main()
{
Console.WriteLine(Getinfo());
Console.ReadKey();
}
public static string Getinfo(string s="")
{
return "with param";
}
public static string Getinfo()
{
return "without param";
}
}
when I run this code, I have "without param" as a result . So I need to know :
- Why I didn't get a compiler exception ( the two methods can be executed) ?
- How overloading methods works if I have, as in the snippet above, methods with optionnal parameters?
Thanks,