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 trialJose Badillo
1,186 PointsI got so far alredy and when I compiled I got an error cs1501 from my MapLocation.cs leading back to Point.DistanceTo.
so it leads me back to my Point.DistanceTo method we created a few classes back and basecly its telling me my method only takes 1 argument I don't know how to fix it and I cant go back to find wich video was the one where we created that class so can anyone help me. I also am following along with VisualStudio and I get the same error when I compile the program but its a bit more descriptive it tell me that the is no parameter y being given to my DistanceTo method but I keep checking and I cant see why it would say that the MapLocation take both an x and y int and a Map in order to know where point should be so please if someone can help me I can send you more info or screen shots
Jose Badillo
1,186 Pointshttps://w.trhou.se/6jy6qc4b83 that's the preview link
5 Answers
Steven Parker
231,268 PointsOn line 14 of MapLocation.cs, you have this:
return DistanceTo(location) <= range;
But "DistanceTo" is not defined to take a "MapLocation" (or "Point") argument. Instead it takes two int arguments, one for each dimension. Maybe you're at an intermediate step in the course and you're about to create an overload method that will handle that argument. But in the meantime, you could make it compile by changing that line to pass it the two arguments:
return DistanceTo(location.X, location.Y) <= range;
Jose Badillo
1,186 PointsThank you yeah I really appreciate that help I'll delete the extra post I did those on acssident trying to find out how to post snap shot
Joshua Thao
6,439 PointsI got the same error you did Jose. I saw this error a while back and thought maybe Jeremy would have gotten to it but he just compiled with no errors so I am thinking he might have fixed it before and not mention it in the video. I know this because I written this part 3 or 4 times lol
kevin hudson
Courses Plus Student 11,987 PointsI have the exact same code as Jose for he MapLocations.cs class so I am not sure why that would be the fix? Anyways in his Point.cs file he is missing the method overload
public int DistanceTo(Point point) {
return DistanceTo(point.xCord, point.yCord);
}
Steven Parker
231,268 PointsThe reason that fix worked for Jose was because he had not created the overload yet. Once the overload has been added, then the original call will compile and work as intended.
kevin hudson
Courses Plus Student 11,987 PointsThanks for clearing that up Steven! Makes sense to me.
Steven Parker
231,268 PointsSteven Parker
231,268 PointsThe best way to share your project for analysis is to make a snapshot of the workspace and post the link to it here.