| 1 | package main |
| 2 | |
| 3 | import "fmt" |
| 4 | |
| 5 | type fii interface { |
| 6 | Hello() |
| 7 | } |
| 8 | |
| 9 | type Boo struct { |
| 10 | Name string |
| 11 | } |
| 12 | |
| 13 | func (b *Boo) Hello() { |
| 14 | fmt.Println("Hello", b) |
| 15 | fmt.Println(b.Name) |
| 16 | } |
| 17 | |
| 18 | func inCall(foo fii) { |
| 19 | fmt.Println("inCall") |
| 20 | foo.Hello() |
| 21 | } |
| 22 | |
| 23 | func main() { |
| 24 | fmt.Println("in") |
| 25 | boo := &Boo{"foo"} |
| 26 | inCall(boo) |
| 27 | } |
| 28 | |
| 29 | // Output: |
| 30 | // in |
| 31 | // inCall |
| 32 | // Hello &{foo} |
| 33 | // foo |