Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WTF are Protocols ?
protocol lifeOfABear {
var fishEatenToday: Int {get}
func eatFish()
func eatHoney()
func ClimbTree()
func sleep()
}
// now all you have to do is make sure you have variable and functions implemented
class PhilTheBear: lifeOfABear {
var fishEatenToday: Int = 200;
func eatFish() {
print("Go down to the east river today")
}
func eatHoney() {
print("Walk over to the bee hive near the old tree")
}
func ClimbTree() {
print("climb up the first tree that has a blue jay")
}
func sleep() {
print("get a sold 12 hours")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.