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 Return Values

What does the "map" in map.OnMap do?

Is the "map" in the equation a new variable, or does it somehow compare the values of the previous map variable to the upcoming method OnMap?

1 Answer

Steven Parker
Steven Parker
230,274 Points

The "map" variable is created at the beginning of the Main routine by "Map map = new Map (8, 5);" A few lines later, the "OnMap" method is called on it to determine if the Point object just created is valid ("on the map").

I'm not sure what you are referring to as the "previous map variable".

Okay, so classes dont have to be declared public right? They are automaticall public and can be used across different files?

Steven Parker
Steven Parker
230,274 Points

The default access level for classes is internal, which means it can be used by any code in the same assembly. In this example, the entire program is one assembly.