所以我在这里有这个例子: 去游乐场
package main
import (
"fmt"
)
type Circle struct{}
func (c Circle) Something() {
fmt.Println("something")
}
type Rectangle struct {
Circle
}
func (a Rectangle) SomethingElse() {
fmt.Println("SomethingElse")
}
type Form Rectangle
func main() {
c := Form{}
c.Circle.Something()
c.SomethingElse()
}
Run Code Online (Sandbox Code Playgroud)
我不明白为什么我可以Something从嵌入式调用Circle,但不能Somethingelse从Rectangle内部调用Form类型.另外我不明白当我声明一种其他类型的类型时会得到什么好处,比如这里Form.