Add value to interface type

package main

type example interface{
LiterExample() int
}
type nlo interface{
example
}
type new struct{
field1 nlo
}
func (n new) LiterExample() int{
return n.field1[0].Literlat()
}
func main() {
var forest =new{nlo{}}
forest.field1=append(forest.field1, ?)
}

How can I add a value to this slice? I mark this field with character ‘?’. I can’t add anything, for example: string, int, other data type.

package main

type example interface {
    LiterExample() int
}

type nlo interface {
    Literlat() int
}

type new struct {
    field1 []nlo
}

func (n new) LiterExample() int {
    return n.field1[0].Literlat()
}

type nlo2 struct {
}

func (nl nlo2) Literlat() int {
    return 0
}

func main() {
    var forest = new{}
    var wat = nlo2{}
    forest.field1 = append(forest.field1, wat)
}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.