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

     1  package main
     2  
     3  import "fmt"
     4  
     5  type Foo struct {
     6  }
     7  
     8  func (Foo) Call() {
     9  	fmt.Println("Foo Called")
    10  }
    11  
    12  type Bar struct {
    13  	Foo
    14  }
    15  
    16  type Baz struct {
    17  	Foo
    18  }
    19  
    20  func (Baz) Call() {
    21  	fmt.Println("Baz Called")
    22  }
    23  
    24  func main() {
    25  	Foo{}.Call()
    26  	Bar{}.Call()
    27  	Baz{}.Call()
    28  }
    29  
    30  // Output:
    31  // Foo Called
    32  // Foo Called
    33  // Baz Called