container/heap
パッケージ内の次のコード スニペットがわかりません。
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
インターフェイスの埋め込みについては、Effective Go で説明されています: http://golang.org/doc/effective_go.html#embedding