Swift Language Defining a Class


Example

You define a class like this:

class Dog {}

A class can also be a subclass of another class:

class Animal {}
class Dog: Animal {}

In this example, Animal could also be a protocol that Dog conforms to.