题解 | #动物和老虎#

动物和老虎

http://www.nowcoder.com/practice/1259760c72514e80967e203aa8ce2f81

题目有问题 已经反馈


import "fmt"

type animal interface {
	sleep()
	eat()
}
type tiger struct {
}

func (t tiger) sleep() {
	fmt.Println("sleep")
}
func (t tiger) eat() {
	fmt.Println("eat")
}
func main() {
	var t animal = tiger{}
	t.sleep()
	t.eat()

}

全部评论
半年过去了,都不见修复,效率喜人啊
点赞 回复 分享
发布于 2023-01-02 15:36 河北

相关推荐

04-28 11:34
西北大学 运营
牛客4396号:不好意思,这个照片猛一看像丁真
点赞 评论 收藏
分享
05-12 17:28
已编辑
门头沟学院 硬件开发
ldf李鑫:不说公司名祝你以后天天遇到这样的公司
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务