github.com/HaHadaxigua/yaegi@v1.0.1/_test/method1.go (about)

     1  package main
     2  
     3  type Sample struct {
     4  	Name string
     5  }
     6  
     7  func (s *Sample) foo(i int) {
     8  	println("in foo", s.Name, i)
     9  }
    10  
    11  func main() {
    12  	sample := Sample{"hello"}
    13  	s := &sample
    14  	s.foo(3)
    15  }
    16  
    17  // Output:
    18  // in foo hello 3