Files
the-way-to-go_ZH_CN/eBook/examples/chapter_10/use_person2.go
2015-03-03 12:25:25 -05:00

14 lines
279 B
Go

package main
import (
"fmt"
"./person"
)
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
}