Skip to content

Instantly share code, notes, and snippets.

@agoiabel
Created January 19, 2018 11:35
Show Gist options
  • Save agoiabel/1e342c681fa10359dbb0b6538f071bbd to your computer and use it in GitHub Desktop.
Save agoiabel/1e342c681fa10359dbb0b6538f071bbd to your computer and use it in GitHub Desktop.
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