Files
the-way-to-go_ZH_CN/eBook/examples/chapter_10/use_person2.go

15 lines
267 B
Go

package main
import (
"./person"
"fmt"
)
func main() {
p := new(person.Person)
// error: p.firstName undefined (cannot refer to unexported field or method firstName)
// p.firstName = "Eric"
p.SetFirstName("Eric")
fmt.Println(p.FirstName()) // Output: Eric
}