下一個(gè)實(shí)現(xiàn)接口附加方法的方法是否正確?(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貢獻(xiàn)1934條經(jīng)驗(yàn) 獲得超2個(gè)贊
您已經(jīng)基本完成了。一旦給location的getKey和getData方法有效的主體,* location將實(shí)現(xiàn)閱讀器接口。無需做任何其他事情。
- 2 回答
- 0 關(guān)注
- 278 瀏覽
添加回答
舉報(bào)
0/150
提交
取消