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 trial

C# C# Objects Methods Static vs Instance Methods

What xDiff =X-x mean ?

So when we say xDiff =X-x x is going to get the value that we are going to pass whenever we create a point on the Map . But what would be the value for X ?Is it the readonly value that we passed when we created the object map
Map map=new Map(8,5) ? Or It is something else that I am not getting?

Thanks

2 Answers

Emmanuel C
Emmanuel C
10,636 Points

Hey Kosta,

The DistanceTo method is on the Point, The capital X and Y are properties of the Point class and initialized in the constructor when the class is created. The small x and y are the method arguments when the method is called.

Point pointObj = new Point(4, 5);
pointObj.DistanceTo(3, 2);

//        X - x
//xDiff = 4 - 3

//        Y - y
// yDiff = 5 - 2    

Hopefully this helps

Hi Emmanuel ,thank you that really helped!

really make understand c# thankyou so much