- Mastering macOS Programming
- Stuart Grimshaw
- 44字
- 2021-07-02 22:54:35
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.