继承

 package main

 import "fmt"

 type Skills  []string

 type person struct {
name string
age int
weight int
} type Student struct {
person //继承
Skills
int
spe string
} func init() { } func main() {
xuxu := Student{person{"xuxu",,}, []string{"anatomy"}, , "boy"} //方式一,全部指定
jane := Student{person:person{"Jane",,}, spe:"Biology"} //方式二,指哪打哪 fmt.Printf("His name is %s\n", jane.name)
fmt.Printf("His name is %s\n", xuxu.name)
}

重载

 package main

 import "fmt"

 type Skills  []string

 type person struct {
name string
age int
weight int
spe string //inner spe,重载
} type Student struct {
person //继承
Skills
int
spe string //outter spe,重载
} func init() { } func main() {
xuxu := Student{person{"xuxu",,,"inner spe"}, []string{"anatomy"}, , "outter spe"} fmt.Printf("His name is %s\n, inner spe :%, outter spe :%s", xuxu.name, xuxu.person.spe, xuxu.spe)
}

最新文章

  1. Grunt_1从安装开始创建一个基本的Grunt
  2. hdu 5877 (dfs+树状数组) Weak Pair
  3. Walkway.js – 用线条制作简约的 SVG 动画
  4. [转]轻松学习Ionic (四) 修改应用图标及添加启动画面(更新官方命令行工具自动生成)
  5. Laravel
  6. Android之Activity与Service通信
  7. 功能分解——Android下画分时图与k线图有感
  8. 使用struct实现面向对象编程的封装
  9. Hibernate Cascade & Inverse
  10. 新闻公布系统 (Asp.net 三层架构 )
  11. linux dd命令
  12. UML之包图
  13. 协议形式化分析Scyther 资料整理
  14. Linux进程的实际用户ID和有效用户ID
  15. nginx thinkphp只能访问首页
  16. 用virtualenv建立独立虚拟环境 批量导入模块信息
  17. Hdu 4622 Reincarnation(后缀自动机)
  18. httpd-2.4.6
  19. LeetCode 9. Palindrome Number(回文数)
  20. win7(x64)安装scrapy框架

热门文章

  1. Ubuntu14.04下编译安装或apt-get方式安装搭建Apache或Httpd服务(图文详解)
  2. weblogic JDBC Connection Pools--转官方文档
  3. nginx基本配置说明
  4. JavaScript中的异步 macrotask 和 microtask
  5. 架构实战项目心得(四):使用Nexus配置Maven私有仓库
  6. [转]Using MVC 6 And AngularJS 2 With .NET Core
  7. pm2在node中的应用
  8. SQL语句表处理
  9. Cheatsheet: 2017 04.01 ~ 04.30
  10. Effective C++ .08 别让异常逃离析构函数