I have the following structures:
type Type interface {
getFoo() []byte
}
type Concrete struct {
}
func (this *Concrete) getFoo() []byte {
example := []byte{2, 3, 4}
return example
}
Now I have some array of Type
interfaces, e.g.:
var arr []*Type
And I want to create array of concrete structures and initialize the above array with it, e.g.:
var cObjArr []*Concrete
cObj := new(Concrete)
cObjArr = append(cObjArr, cObj)
arr = cObj
But it gives me an error that cannot use type []*Concrete as type []*Type in assignment
. What's wrong?