1、定义结构体

type Student struct {

    name string
   code int
}
 
 
 
2、类型别名
type i int64
var age i = 30
 
 
3、定义接口
type inter interface{
  eat()
  walk()
}
 
 
4、定义函数类型
type fun_handler func(name string) int
 
 
type本职都是做和类型相关的事。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2019-11-28
  • 2019-11-26
  • 2021-06-29
  • 2021-09-14
  • 2022-12-23
  • 2019-11-20
猜你喜欢
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-11-18
  • 2021-10-24
  • 2021-11-03
相关资源
相似解决方案