Declare a class with inheritance


I have a parent class and want to create another one which "inherits" it.


// Create 'parent' class
class Animal {

	func sayHello() {

// Create a child class
// which 'inherits' our parent class
class Dog : Animal {


// Create a new Dog instance
let myDog = Dog()

// We can also access its parent's methods


Find answers here

Hi there! Ask Us a Question We are ready to help