Test your knowledge
- A class can conform to:
- Only one protocol
- One or more protocols
- A maximum of two protocols
- When a class conforms to a protocol:
- It cannot inherit from a class
- It can inherit from an abstract class
- It can also inherit from a class
- A protocol:
- Can inherit from another protocol
- Can inherit from a class
- Cannot inherit from another protocol
- A protocol:
- Is a type
- Is a method
- Is the base class for other classes
- When we specify a protocol as the type for an argument:
- We can use any type method that conforms to the specified protocol as an argument
- We can use any protocol that conforms to the specified protocol as an argument
- We can use any instance of a class that conforms to the specified protocol as an argument
- If we want a protocol to be accessed ...
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.