mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
23 lines
207 B
Go
23 lines
207 B
Go
package main
|
|
|
|
type I interface {
|
|
inI()
|
|
}
|
|
|
|
type T struct {
|
|
name string
|
|
}
|
|
|
|
func (t *T) inI() {}
|
|
|
|
func main() {
|
|
var i I = &T{name: "foo"}
|
|
|
|
if i, ok := i.(*T); ok {
|
|
println(i.name)
|
|
}
|
|
}
|
|
|
|
// Output:
|
|
// foo
|