2015-10-01 00:36:36 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-10-18 17:37:13 +00:00
|
|
|
"fmt"
|
|
|
|
"runtime"
|
2015-10-01 00:36:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type A struct {
|
2015-10-18 17:37:13 +00:00
|
|
|
val int
|
2015-10-01 00:36:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type C struct {
|
|
|
|
s string
|
|
|
|
}
|
|
|
|
|
|
|
|
type B struct {
|
2015-10-18 17:37:13 +00:00
|
|
|
A
|
2015-10-01 00:36:36 +00:00
|
|
|
*C
|
2015-10-18 17:37:13 +00:00
|
|
|
a A
|
|
|
|
ptr *A
|
2015-10-01 00:36:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2015-10-18 17:37:13 +00:00
|
|
|
b := B{A: A{-314}, C: &C{"hello"}, a: A{42}, ptr: &A{1337}}
|
2015-10-30 11:39:32 +00:00
|
|
|
b2 := B{A: A{42}, a: A{47}}
|
2015-10-18 17:37:13 +00:00
|
|
|
runtime.Breakpoint()
|
2015-10-30 11:39:32 +00:00
|
|
|
fmt.Println(b, b2)
|
2015-10-18 17:37:13 +00:00
|
|
|
fmt.Println(b.val)
|
|
|
|
fmt.Println(b.A.val)
|
|
|
|
fmt.Println(b.a.val)
|
|
|
|
fmt.Println(b.ptr.val)
|
|
|
|
fmt.Println(b.C.s)
|
|
|
|
fmt.Println(b.s)
|
|
|
|
}
|