#!/usr/bin/env /friends/bin/goscript package main import "fmt" type Dog struct {} func (*Dog) Say() { fmt.Println("bow wow") } type Cat struct {} func (*Cat) Say() { fmt.Println("mew mew") } type Animal interface { Say() } type Human struct { animal Animal } func (h *Human) touch() { h.animal.Say() } func main() { h1 := &Human { &Dog {} } h2 := &Human { &Cat {} } h1.touch() h2.touch() }