package main
import (
"fmt"
)
type Foo struct {
bar Bar
}
type Bar struct {
number int
word string
}
func NewFoo(number int, word string) *Foo {
return &Foo{Bar{number, word}}
}
func main() {
f := NewFoo(10, "testing")
fmt.Printf("%+v\n%#v\n%v", f, f, f)
}
$ go run main.go
&{bar:{number:10 word:testing}}
&main.Foo{bar:main.Bar{number:10, word:"testing"}}
&{{10 testing}}
Top comments (0)