| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | ) |
| 6 | |
| 7 | var _ = (HelloInterface)((*Hello)(nil)) |
| 8 | |
| 9 | type HelloInterface interface { |
| 10 | Hi() string |
| 11 | } |
| 12 | |
| 13 | type Hello struct{} |
| 14 | |
| 15 | func (h *Hello) Hi() string { |
| 16 | return "hi" |
| 17 | } |
| 18 | |
| 19 | func main() { |
| 20 | h := &Hello{} |
| 21 | fmt.Println(h.Hi()) |
| 22 | } |
| 23 | |
| 24 | // Output: |
| 25 | // hi |