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

接口方法.

接口方法.

Go
拉丁的传说 2021-03-29 16:08:45
下一个实现接口附加方法的方法是否正确?(getKey,getData)type reader interface {    getKey(ver uint) string    getData() string}type location struct {    reader    fileLocation string    err os.Error}func (self *location) getKey(ver uint) string {...}func (self *location) getData() string {...}func NewReader(fileLocation string) *location {    _location := new(location)    _location.fileLocation = fileLocation    return _location}
查看完整描述

2 回答

?
撒科打诨

TA贡献1934条经验 获得超2个赞

您已经基本完成了。一旦给location的getKey和getData方法有效的主体,* location将实现阅读器接口。无需做任何其他事情。


查看完整回答
反对 回复 2021-04-26
  • 2 回答
  • 0 关注
  • 239 浏览
慕课专栏
更多

添加回答

举报

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