Created
November 20, 2019 17:52
-
-
Save riccjohn/87dd9b4e2df2b9c79fb5c7b7e5e2ef7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal { | |
func eat() { | |
print("nom nom nom") | |
} | |
} | |
class Dog: Animal { | |
func bark() { | |
print("woof!") | |
} | |
} | |
class Cat: Animal { | |
func meow() { | |
print("meow!") | |
} | |
} | |
let Quinn = Dog() | |
Quinn.bark() // "woof!" | |
Quinn.eat() // "nom nom nom" | |
let Riccardo = Cat() | |
Riccardo.meow() // "meow!" | |
Riccardo.eat() // "nom nom nom" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment