This is a created article in which the information may have evolved or changed.
In the go language, one or more interfaces (such as interfaces B, c) can be combined in interface A, which is equivalent to adding a method declared in interface B and C in interface A.
Interfaces can be combined in a way that is equivalent to the method of adding other interfaces to the interface type Reader interface {read ()}type Writer Interface {write ()}//defines the implementation class of the two interfaces above type Myreadwrite Struct{}func (MRW *myreadwrite) Read () {FMT. Println ("Myreadwrite...read")}func (MRW *myreadwrite) write () {FMT. Println ("Myreadwrite...write")}//defines an interface that combines the above two interfaces type Readwriter interface {readerwriter}//The above interfaces are equivalent to: type ReadWriterV2 interface {Read () write ()}//readwriter and ReadWriterV2 two interfaces are equivalent, so can be assigned to each other Func interfaceTest0104 () {MRW: = The &MYREADWRITE{}//MRW object implements the Read () method and the Write () method, so you can assign values to Readwriter and readwriterv2var rw1 readwriter = Mrwrw1.read () Rw1.write () fmt. PRINTLN ("------") var rw2 ReadWriterV2 = Mrwrw2.read () rw2.write ()//At the same time, Readwriter and ReadWriterV2 two interface objects can be assigned to each other RW1 = Rw2rw2 = RW1}