Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJacek Gałka
10,274 PointsOverloaded methods return type
"Overloaded methods in the same class must return the same type" - said Jeremy Is this true?
I overload DistanceTo method with Point type parameter, return double and there is no compiler errors. Also in the Math class there are plenty of methods that are overloaded and return different types.
2 Answers
Steven Parker
231,269 PointsI think you've discovered a bug in the lesson.
I've used C# for years and I'm also not aware of any such restriction. Perhaps he meant to say that overloaded members may not differ by only the return type.
You might want to report this as a bug on the Support page.
Jacek Gałka
10,274 PointsIt's my pleasure. ?
Jeremy McLain
Treehouse Guest TeacherJeremy McLain
Treehouse Guest TeacherSteven's correct. I'll have that line removed. Thanks for catching that Jacek Gałka! I'll get you an exterminator badge.