golang interface

   type MyInterface interface{
       Print()
   }
   
   func TestFunc(x MyInterface) {}
   type MyStruct struct {}
   func (me MyStruct) Print() {}
   
   func main() {
       var me MyStruct
       TestFunc(me)
   }

  

posted @ 2019-12-18 13:57  Ellen_Fu  阅读(66)  评论(0编辑  收藏  举报