Classes and Multiple Inheritance

suggest change

Swift does not support multiple inheritance. That is, you cannot inherit from more than one class.

class Animal { ... }
class Pet { ... }

class Dog: Animal, Pet { ... } // This will result in a compiler error.

Instead you are encouraged to use composition when creating your types. This can be accomplished by using protocols.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents