में इंटरफेस में इंटरफेस सूचीबद्ध करना मुझे container/heap
पैकेज में निम्न कोड स्निपेट नहीं समझा जाता है।गो
type Interface interface {
sort.Interface //Is this line a method?
Push(x interface{})
Pop() interface{}
}
में इंटरफेस में इंटरफेस सूचीबद्ध करना मुझे container/heap
पैकेज में निम्न कोड स्निपेट नहीं समझा जाता है।गो
type Interface interface {
sort.Interface //Is this line a method?
Push(x interface{})
Pop() interface{}
}
यह एक प्रकार की घोषणा है।
heap.Interface
इंटरफ़ेस sort.Interface
इंटरफ़ेस एम्बेड करता है।
आप विरासत/विशेषज्ञता का एक प्रकार के रूप में यह देख सकते हैं: इसका मतलब है कि heap.Interface
इंटरफेस को लागू करने structs जो कि sort.Interface
तरीकों और Push
और Pop
तरीकों को लागू करने के रूप में परिभाषित कर रहे हैं।
इंटरफ़ेस embeding में प्रभावी जाओ वर्णित है: जवाब के लिए http://golang.org/doc/effective_go.html#embedding
धन्यवाद। – Herks