github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/method34.gno (about) 1 package main 2 3 type Root struct { 4 Name string 5 } 6 7 type One struct { 8 Root 9 } 10 11 type Hi interface { 12 Hello() string 13 } 14 15 func (r *Root) Hello() string { return "Hello " + r.Name } 16 17 func main() { 18 var one interface{} = &One{Root{Name: "test2"}} 19 println(one.(Hi).Hello()) 20 } 21 22 // Output: 23 // Hello test2