|
|
|
|
|
by doragcoder
4067 days ago
|
|
You can use object composition: http://play.golang.org/p/jyS38luYjM Then make a Draw() method on the single object default to what you expect. The simple inline explanation is: type SingleObject struct {
Cowboy
Shape
}
Access is as follows to be unambiguous: Woody.Cowboy.Draw()
Woody.Shape.Draw()
|
|
They all are the same interface and can be passed into each other's methods, leading to a logical error.