Test your knowledge
- When we declare protocols, the
Self
keyword signifies:- The type that implements the protocol.
- The instance of a class that conforms to the protocol.
- The instance of a struct that conforms to the protocol.
- Generics allow us to declare a class that:
- Can use a generic type only as the type for stored and type properties.
- Can use a generic type only as an argument for its initializers.
- Can work with many generic types.
- The
open class ImmutableVector3D<T: FloatingPoint>
line means:- The generic type constraint specifies that
T
must conform to theImmutableVector3D
protocol or belong to theImmutableVector3D
class hierarchy. - The generic type constraint specifies that
T
must conform to theFloatingPoint
protocol or belong to theFloatingPoint ...
- The generic type constraint specifies that
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.