package main
import "fmt"
type ContactInfo struct {
email string
zipCode string
}
type Person struct {
firstName string
lastName string
age int
isActive bool
contactInfo ContactInfo
}
func main() {
abelh := Person{
firstName: "Abelh",
lastName: "Orihuela",
contactInfo: ContactInfo{
email: "[email protected]",
zipCode: "12345",
},
}
abelhPointer := &abelh
abelhPointer.setName("Dario")
abelh.print()
}
func (p *Person) setName(newName string) {
(*p).firstName = newName
}
func (p Person) print() {
fmt.Printf("%+v", p)
}