| 1 | package main |
| 2 | |
| 3 | import "fmt" |
| 4 | |
| 5 | type Myint int |
| 6 | |
| 7 | func (i Myint) Double() { fmt.Println("Myint:", i, i) } |
| 8 | |
| 9 | type Boo interface { |
| 10 | Double() |
| 11 | } |
| 12 | |
| 13 | func f(boo Boo) { boo.Double() } |
| 14 | |
| 15 | func g(i int) Boo { return Myint(i) } |
| 16 | |
| 17 | func main() { |
| 18 | f(g(4)) |
| 19 | } |
| 20 | |
| 21 | // Output: |
| 22 | // Myint: 4 4 |