- Mastering macOS Programming
- Stuart Grimshaw
- 44字
- 2025-04-04 19:10:25
Mixed type arrays, anybody?
Did you notice something there? Look at these lines again:
myCoordinates.append(myCartesianPosition)
myCoordinates.append(myPolarPosition)
Using an enum as an array type, [someEnum], we can store different types, using the associated types mechanism, within one Array.
And all of that in complete type-safety.