package main
import (
"fmt"
)
type Person06 struct {
name string
sex string
age int
}
func (p *Person06) printInfo() {
fmt.Println(p)
}
type Student06 struct {
Person06
id int
}
//重写父类方法
func (s *Student06) printInfo() {
fmt.Println(s)
}
func main() {
var s Student06 = Student06{Person06{"yy", "男", 18}, 1}
(&s).printInfo()
(&s).Person06.printInfo()
}
Go语言 之方法重写
原创
©著作权归作者所有:来自51CTO博客作者样子2018的原创作品,请联系作者获取转载授权,否则将追究法律责任
上一篇:Go语言 之延迟调用defer
下一篇:易语言 之工具条
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
如何重写gorm日志(实现自定义慢sql打印)
gorm自定义日志格式,可实现慢sql自定义打印
sql SQL mysql -
Dubbo为什么要用Go重写
我常常在散步时思考很多技术上的「为什么问题」,有时一个问题会它被用Go重写并开源,如今两年过去,已经从当初的V1.0.0版本发展到了V3.0.0,截止目前star数3.8K。有一
golang java 开发语言 开发效率 线程池 -
RabbitTemplate 重写 重写viewgroup
重写View与ViewGroup相关资料: http://www.gcssloop.com/customview/CustomViewIndex/https://www.j
RabbitTemplate 重写 android ide List -
用执行计划看下索引有没有命中就行
1.执行计划数据项Plan hash value: 系统为SQL语句生成的执行计划的哈希值,用以标识该执行计划。 Id: SQL语句执行计划中,各个节点的编号,用以标识和区分执行计划中的不同节点。
用执行计划看下索引有没有命中就行 oracle 执行计划 数据项 SQL