I don't get the Method Overloading Tutorial C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I don't get the Method Overloading Tutorial C#

I try to use this just like in the lesson: static void Print33(int a) { Console.WriteLine("Value: " + a); } static void Print33(double a) //does this still work? IDE gives error 'cuz name still exists. { Console.WriteLine("Value: " + a); } VisualStudio throws an error because the name exists, but the args are obviously different. What gives?

2nd Oct 2020, 12:45 AM
Andrei Ion
Andrei Ion - avatar
4 Answers
+ 2
Yeah i figured it out. Had to place these Print33 out of Main.. First time here sorry, thank you for the quick reply
2nd Oct 2020, 1:41 AM
Andrei Ion
Andrei Ion - avatar
+ 3
Can you share your complete code? I tried it just now, and there's no problem. Save the code and share its link instead, more convenient for analysis. Follow the below guide to sharing links 👍 https://www.sololearn.com/post/75089/?ref=app
2nd Oct 2020, 1:16 AM
Ipang
+ 1
Ah ok, not a problem 👌
2nd Oct 2020, 1:43 AM
Ipang
0
18th Oct 2022, 5:46 AM
brayan