首页 > 其他 > 详细

go interface

时间:2015-05-14 15:47:03      阅读:147      评论:0      收藏:0      [点我收藏+]

1 接口定义:

type iface_name interface{

  //....

}

 

2 接口实现

// 非空接口

type iface struct {

  tab     *itab

  data    unsafe.Pointer  // data *int

}

// 空接口

type iface struct {

  _type  *_type

  data    unsafe.Pointer  // data *int

}

type _type struct {

  size          uintptr

  hash        uint32

  _unused   uint8

  align         uint8

  fieldalign   uint8

  kind         uint8

      alg           unsafe.Pointer

      gc           [2]uintptr

      _string     *string

      x            *uncommontype

      ptrto       *_type

      zero        *byte

}

 

 

参考:

http://www.cnblogs.com/concurrency/p/4311958.html

 

go interface

原文:http://www.cnblogs.com/--xiaoyao--/p/4503108.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!