7
container/heap
パッケージの次のコードスニペットは理解できません。Goのインターフェイスの一覧表示
type Interface interface {
sort.Interface //Is this line a method?
Push(x interface{})
Pop() interface{}
}
container/heap
パッケージの次のコードスニペットは理解できません。Goのインターフェイスの一覧表示
type Interface interface {
sort.Interface //Is this line a method?
Push(x interface{})
Pop() interface{}
}
これは型宣言です。
heap.Interface
インターフェイスには、sort.Interface
インターフェイスが組み込まれています。
あなたは、継承/専門の一種としてそれを見ることができます:それはheap.Interface
インタフェースを実装する構造体がsort.Interface
方法とPush
とPop
メソッドを実装するものとして定義されていることを意味します。
インタフェースの埋込みは、効果的な移動で説明されていますhttp://golang.org/doc/effective_go.html#embedding
感謝を答え。 – Herks