Array Elements Referencing Objects
The source program of Listing 10.13 shown later utilizes an array of elevators (line 35) to effectively control a collection of elevators. It is used to demonstrate the syntax and mechanics involved when array elements hold references to objects. Recall the elevator simulation example from Chapter 5. It defined an Elevator similar to that found in lines 3–29 of Listing 10.13, but only employed one of this kind. The Main() method (lines 33–54) in contrast manages 10 elevators.
To better focus on the important issues surrounding arrays of objects, the program has omitted some of the aspects included in the example of Chapter 5. There are, for example, no Person objects here; instead, the elevators are manipulated ...
Get C# Primer Plus now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.