Files
moxa/_test/interface1.go
Marc Vertes 17fa77c693 fix: implement handling of interface types (#80)
Methods are now resolved correctly on interface objects.
2019-02-06 10:21:25 +01:00

34 lines
349 B
Go

package main
import "fmt"
type fii interface {
Hello()
}
type Boo struct {
Name string
}
func (b *Boo) Hello() {
fmt.Println("Hello", b)
fmt.Println(b.Name)
}
func inCall(foo fii) {
fmt.Println("inCall")
foo.Hello()
}
func main() {
fmt.Println("in")
boo := &Boo{"foo"}
inCall(boo)
}
// Output:
// in
// inCall
// Hello &{foo}
// foo