28/2 Struct Pointer study
Code package main import "fmt" type Person struct { Address string PostCode string JobType string Company string } type PersonBuilder struct { person *Person } func NewPersonBuilder() *PersonBuilder { return &PersonBuilder{&Person{}} } func main() { pb := NewPersonBuilder() //&{0xc0000b6040} pd := &Person{"a", "b", "c", "d"} //&{a b c d} fmt.Println(pb, pd) }Result &{0xc0000b6040} &{a b c d} pb ..
Go/Study record
2022. 3. 1. 01:02