November 2016
Intermediate to advanced
480 pages
14h 42m
English
In Chapter 15, you learned about class inheritance. Any function that expects an argument of a class can also accept arguments that are subclasses of that class. This ability to accept either a class or any subclass of it is often referred to as polymorphism, but is more accurately known as runtime polymorphism or subclass polymorphism. Polymorphism, meaning “many forms,” allows you to write a single function that can accept different types.
Runtime polymorphism is a powerful tool, and the frameworks Apple provides for development use it frequently. Unfortunately, it also has drawbacks. Classes that are related by inheritance are tied together tightly: It can be difficult to change one ...
Read now
Unlock full access