more
This commit is contained in:
22
34-embedding.go
Normal file
22
34-embedding.go
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user