Generic Functions in Go

后端 未结 3 1955
借酒劲吻你
借酒劲吻你 2021-01-18 11:16

I\'m in the process of learning Go and the documentation and interactive lessons say that an empty interface can hold any type, as it requires no a

3条回答
  •  旧巷少年郎
    2021-01-18 11:41

    Golang doesn't have a generic type, so the way you get around this is passing interface type and using type switches within the function.

提交回复
热议问题