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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Jamie Wyton](https://uploads.teamtreehouse.com/production/profile-photos/7949972/micro_IMG-20160325-WA0001.jpg)
Jamie Wyton
3,011 Pointscan two identical fields exist at the same time?
In getting so far with programming C# I realised that I'm duplicating a field of the same type and of the same name. For example in my main method I have delcared: Map map = new Map(8, 5);
Yet in other classes, for example the MapLocation constructor: public MapLocation(int x, int y, Map map) : base(x, y) {.....}
How does a computer cope with having two identical field types?
2 Answers
![Jamie Wyton](https://uploads.teamtreehouse.com/production/profile-photos/7949972/micro_IMG-20160325-WA0001.jpg)
Jamie Wyton
3,011 Pointsyes ok they're instances of objects, what I mean is when that line is executed we have an object of Map called map, and then when another method is called in another class, another object is passed as an argument of type Map also being called map. Does that mean that we have two Map map?
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThere are no fields in your examples.
Your first example is the creation of a class instance, and the second one is the declaration of a class constructor. There are not any fields in either example.
Regarding the names, let's look at that first example:
Map map = new Map(8, 5);
Here a variable named "map" (with small "m") is being created, and it's type is class "Map" (capital "M"). C# is case sensitive, so these two names are different. Then, the variable is being assigned by using the new operator and calling the class constructor which has the same name as the class itself ("Map"), but can be distinguished by the arguments being passed to it in parentheses following the name.
Does that clear things up?
Steven Parker
230,688 PointsSteven Parker
230,688 PointsYou might, in a sense. One is an actual object named "map", and the other is is a passed parameter name that is simply a substitute for the real name of the object passed in as an argument in the method call.