|
|
|
|
|
by unscaled
3432 days ago
|
|
No they're not. io.Reader and sync.Mutex do not embed the same type and do not have conflicting methods with the same name. This is how a diamond looks like: type Base struct {
Foo int32
}
type Child1 struct {
Base
}
type Child2 struct {
Base
}
type Diamond struct {
Child1
Child2
}
func (c *Child1) DoSomething() {
fmt.Println(c.Foo)
}
func (c *Child2) DoSomething() {
fmt.Println(c.Foo)
}
func main() {
c := Diamond { }
c.Foo = 42 // Doesn't Compile
c.Child1.Foo = 10
c.Child2.Foo = 20
c.DoSomething() // Doesn't Compile
}
|
|