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

Two embedded structs each promote a method with the same name to the outer struct. The outer struct does not define that method itself. What happens?

type A struct{} func (A) Hello() string { return "A" } type B struct{} func (B) Hello() string { return "B" } type C struct { A B } func main() { var c C _ = c.Hello() }