Open kdeng opened 2 years ago
package main import ( "fmt" ) type MyInterface interface { Test() int } type MyType struct { data int } func (m MyType) Test() int { m.data = 444 return m.data } func AcceptInterface(i MyInterface) { fmt.Println(i.Test()) } func main() { object := MyType{data: 123} fmt.Println(object) AcceptInterface(object) fmt.Println(object) }