Go - Methods of an interface
Posted
by nevalu
on Stack Overflow
See other posts from Stack Overflow
or by nevalu
Published on 2010-05-15T21:58:01Z
Indexed on
2010/05/15
22:02 UTC
Read the original article
Hit count: 281
Would be correct the next way to implement the methods attached to an interface? (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
}
© Stack Overflow or respective owner