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 trialDalin Nkulu
15,587 Points"Distanceto" method seem to not allow Maplocation object in the parameter
when i include location (Maplocation's object) in "DistanceTo" method i get this error(from VS 2017) : there is no argumnet given that corresponds to the required formal parameter 'y' of 'Point.DistanceTo(int,int)'
I think "DistanceTo" required two parameter (X and Y) while i m just giving one "location" but this should work since location is a object of the class Maplocation. i m confuse
2 Answers
Ricardo Ponce
1,705 Pointsthe real error should shows like this: MapLocation.cs(15,14): error CS1501: No overload for method DistanceTo' takes
1' arguments
Point.cs(17,16): (Location of the symbol related to previous error)
Its like the DistanceTo method did not recognise location, I think the problem is that MapLocation is passing an extra argument which is Map, it should be two parameters, it worked but there might be another solution,
Daniel Hunter
4,622 PointsI came across the same issue. I found that the method is expecting "X" and "Y" parameters. You can access the location variables data by passing in location.X and location.Y
The method seems to work as it now has the parameters it was expecting. (see below)
return DistanceTo(location.X, location.Y) <= range;