mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 03:55:28 +08:00
14 lines
279 B
Go
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
|
|
} |