December 2018
Intermediate to advanced
414 pages
10h 19m
English
The abstract base class is very similar to the AnyAnimal public wrapper due to the following:
The convention begs to call this class _Any#MY_PROTOCOL#Base<>. As the design pattern requires the implementation of this class as an abstract class, we implement it with fatalError():
private class _AnyAnimalBase<F>: Animal where F: Food { var preferredFood: F? { get { fatalError() } set { fatalError() } } var name: String { fatalError() } func eat(food: F) { fatalError() }}
Read now
Unlock full access