github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/interface37.gno (about) 1 package main 2 3 type I interface { 4 A() string 5 B() string 6 } 7 8 type s struct{} 9 10 func NewS() (I, error) { 11 return &s{}, nil 12 } 13 14 func (c *s) A() string { return "a" } 15 func (c *s) B() string { return "b" } 16 17 func main() { 18 s, _ := NewS() 19 println(s.A()) 20 } 21 22 // Output: 23 // a