C# C# Objects Encapsulation and Arrays Null Reference

Pranava Varshan
Pranava Varshan
3,082 Points

Declaring _path as a MapLocation[] type

Should have asked this buy anyway .

How can _path be declared a MapLocation[] ???

Integer has a range . -2,147,483,648 to 2,147,483,647. So integer accept integers form that range.

What does MapLocation[] accept and its range ???

1 Answer

Steven Parker
Steven Parker
203,214 Points

I'm not sure what your first question is asking. A variable can be declared as any possible type. So "_path" is declared as an array of MapLocation objects.

But MapLocation[] accepts a collection of MapLocation objects, and each one contains inside it two integers named "X" and "Y". Both of these have the value range that you indicated. But the practical range is much smaller, as it must be within the limits of the map argument passed when the instance is created.