Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGostruct embedding and promotionSingle-choice MCQ

Given embedding where both the embedded type and outer type define the same method, what does this print?

type Animal struct{} func (Animal) Speak() string { return "..." } type Dog struct{ Animal } func (Dog) Speak() string { return "woof" } func main() { var d Dog fmt.Println(d.Speak()) fmt.Println(d.Animal.Speak()) }