💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
``` package main import "fmt" type Usb interface { Start() Stop() } type Phone struct { } func (u Phone)Start() { fmt.Println("phone start ....") } func (u Phone)Stop() { fmt.Println("phone stop ....") } type Camora struct { } func (u Camora)Start() { fmt.Println("Camora start ....") } func (u Camora)Stop() { fmt.Println("Camora stop ....") } func TestUsb(u Usb) { u.Start() u.Stop() } func main() { var phone Usb = Phone{} phone.Start() phone.Stop() var camora Usb = Camora{} camora.Start() camora.Stop() var phone1 Phone var camora1 Camora TestUsb(phone1) TestUsb(camora1) } ```