Test your knowledge

  1. When we declare protocols, the Self keyword signifies:
    1. The type that implements the protocol.
    2. The instance of a class that conforms to the protocol.
    3. The instance of a struct that conforms to the protocol.

  2. Generics allow us to declare a class that:
    1. Can use a generic type only as the type for stored and type properties.
    2. Can use a generic type only as an argument for its initializers.
    3. Can work with many generic types.

  3. The open class ImmutableVector3D<T: FloatingPoint> line means:
    1. The generic type constraint specifies that T must conform to the ImmutableVector3D protocol or belong to the ImmutableVector3D class hierarchy.
    2. The generic type constraint specifies that T must conform to the FloatingPoint protocol or belong to the FloatingPoint ...

Get Swift 3 ObjectOriented Programming - Second Edition 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.