草庐IT

MyBoxItem

全部标签

go - 无法使用 Go 在函数中覆盖列表类型接口(interface) {}

不能使用Go在函数中覆盖列表类型接口(interface){}。对我来说很重要,然后我在一个函数中执行。如何修复?packagemainimport("fmt")typeMyBoxItemstruct{Namestring}typeMyBoxstruct{Items[]MyBoxItem}func(box*MyBox)AddItem(itemMyBoxItem)[]MyBoxItem{box.Items=append(box.Items,item)returnbox.Items}funcPrintCustomArray(listinterface{})interface{}{//ite

go - 无法使用 Go 在函数中覆盖列表类型接口(interface) {}

不能使用Go在函数中覆盖列表类型接口(interface){}。对我来说很重要,然后我在一个函数中执行。如何修复?packagemainimport("fmt")typeMyBoxItemstruct{Namestring}typeMyBoxstruct{Items[]MyBoxItem}func(box*MyBox)AddItem(itemMyBoxItem)[]MyBoxItem{box.Items=append(box.Items,item)returnbox.Items}funcPrintCustomArray(listinterface{})interface{}{//ite