Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Fernando Boza
25,384 PointsType does not conform to protocol ...
hey folks, I don't understand how to fix the challenge. If anyone can explain would be appreciated. It's asking me to
"For the next step, create a struct named Dog that conforms to PetType. "
protocol AnimalType {
var numberOfLegs: Int { get }
}
protocol PetType: AnimalType {
var cuddlyName: String { get }
}
struct Dog: PetType {
func bark() -> String {
return "\(numberOfLegs)"
}
}
1 Answer

jcorum
71,828 PointsThe problem is that your struct doesn't conform to the protocols AnimalType and PetType. You need to implement both stored properties:
struct Dog: PetType {
var numberOfLegs: Int
var cuddlyName: String
}
Fernando Boza
25,384 PointsFernando Boza
25,384 Pointsthanks jcorum, didn't know I can conform var, though as simple as it seems