为了账号安全,请及时绑定邮箱和手机立即绑定

如何在Go中子类化

如何在Go中子类化

Go
波斯汪 2021-03-29 13:15:58
在CI中可以做这样的事情struct Point {  int x,y;}struct Circle {  struct Point p;       // must be first!  int rad;}void move(struct Point *p,int dx,int dy) {    ....}struct Circle c = .....;move( (struct Point*)&c,1,2);使用这种方法,我可以传递任何以struct Point作为第一个成员的struct(Circle,Rectangle等)。我该如何在Google Go中执行相同的操作?
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 198 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信