| 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 | type Bir struct { |
| 14 | Boo |
| 15 | } |
| 16 | |
| 17 | func (b Boo) Hello() { |
| 18 | fmt.Println("Hello", b) |
| 19 | fmt.Println(b.Name) |
| 20 | } |
| 21 | |
| 22 | func inCall(foo fii) { |
| 23 | fmt.Println("inCall") |
| 24 | foo.Hello() |
| 25 | } |
| 26 | |
| 27 | func main() { |
| 28 | bir := Bir{Boo{"foo"}} |
| 29 | inCall(bir) |
| 30 | } |
| 31 | |
| 32 | // Output: |
| 33 | // inCall |
| 34 | // Hello {foo} |
| 35 | // foo |