C# C# Objects Object-Oriented Programming Fields

Why do we say map Map = new map? I couldn't find the part where this was introduced.

Sorry if this is an obvious question. What does each map stand for and why is one capitalized? thank you

Peter McClory
Peter McClory
2,365 Points

Just to clarify, it should be: Map map = new Map();

The capitalisation is important so that you know that you are making an instance of the Map class and assigning it to the variable map.

1 Answer

in C# and in other programming languages u instaniate an object with the keyword "new" followed by the name of the object ur instatiating. for example i have class named "Car". to get access to the "Car" class methods in another file ill need to create a new object of type Car.

Car variableName = new Car();

lets say i have a method called "drive". because i have i created an object of type Car i can use it like that:

variableName.drive();
``