Created
January 19, 2018 11:35
-
-
Save agoiabel/1e342c681fa10359dbb0b6538f071bbd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
protocol Animal { | |
var noOfLegs: Int | |
} | |
protocol Pet: Animal { | |
var name: String | |
} | |
class Dog: Pet { | |
//we must have the var name & noOfLegs in the Dog class | |
var name: String | |
var noOfLegs: Int | |
init(name: String, noOfLegs: Int) { | |
self.name = name | |
self.noOfLegs = noOfLegs | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment