mirror of
https://github.com/traefik/yaegi.git
synced 2026-06-01 18:37:56 +00:00
29 lines
299 B
Go
29 lines
299 B
Go
package main
|
|
|
|
type I interface {
|
|
Hello()
|
|
}
|
|
|
|
type T struct {
|
|
h I
|
|
}
|
|
|
|
func (t *T) Hello() { println("Hello") }
|
|
|
|
func main() {
|
|
t := &T{}
|
|
println(t.h != nil)
|
|
println(t.h == nil)
|
|
t.h = t
|
|
println(t.h != nil)
|
|
println(t.h == nil)
|
|
t.h.Hello()
|
|
}
|
|
|
|
// Output:
|
|
// false
|
|
// true
|
|
// true
|
|
// false
|
|
// Hello
|