16 lines
169 B
Go
16 lines
169 B
Go
package main
|
|
|
|
type S struct {
|
|
Child *S
|
|
Name string
|
|
}
|
|
|
|
func main() {
|
|
s := &S{Name: "root"}
|
|
s.Child = &S{Name: "child"}
|
|
println(s.Child.Name)
|
|
}
|
|
|
|
// Output:
|
|
// child
|