题解 | #动物和老虎#

动物和老虎

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 河北

相关推荐

点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

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