This commit is contained in:
Mark McGranaghan 2012-09-16 14:56:56 -07:00
parent f497e342f2
commit 03c8a4983a

22
34-embedding.go Normal file
View File

@ -0,0 +1,22 @@
package main
import "fmt"
type Person struct {
Name string
}
func (p *Person) Talk() {
fmt.Println("Hi, my name is", p.Name)
}
type Android struct {
Person
Model string
}
func main() {
android := new(Android)
android.Name = "Milo"
android.Talk()
}