protocol Cloner {
func cloneSelf(thingBeingCloned t: Self) -> Self
}
final class Sheep : Cloner {
func cloneSelf(thingBeingCloned t: Sheep) -> Sheep {
let newSheep = Sheep.init()
return newSheep
}
}
If I take the keyword 'final' away before class Sheep, the compiler yells at me. I get the error:
method 'cloneSelf(thingBeingCloned:)' in non-final class 'Sheep' must return `Self` to conform to protocol 'Cloner'
Okay.. then I listen to that and I change the return value to Self instead of Sheep, then I get another error:
error: cannot convert return expression of type 'Sheep' to return type 'Self'