From 9574157fc3f35e8032debd2f2019c26c03125c4f Mon Sep 17 00:00:00 2001 From: Noah Matisoff Date: Thu, 2 Apr 2015 09:15:46 -0700 Subject: [PATCH] fix speciality to specialty --- en/02.4.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/en/02.4.md b/en/02.4.md index ac01d584..37475678 100644 --- a/en/02.4.md +++ b/en/02.4.md @@ -105,7 +105,7 @@ Let's see one example. type Student struct { Human // embedded field, it means Student struct includes all fields that Human has. - speciality string + specialty string } func main() { @@ -116,11 +116,11 @@ Let's see one example. fmt.Println("His name is ", mark.name) fmt.Println("His age is ", mark.age) fmt.Println("His weight is ", mark.weight) - fmt.Println("His speciality is ", mark.speciality) + fmt.Println("His specialty is ", mark.specialty) // modify notes - mark.speciality = "AI" - fmt.Println("Mark changed his speciality") - fmt.Println("His speciality is ", mark.speciality) + mark.specialty = "AI" + fmt.Println("Mark changed his specialty") + fmt.Println("His specialty is ", mark.specialty) // modify age fmt.Println("Mark become old") mark.age = 46 @@ -157,17 +157,17 @@ All the types in Go can be used as embedded fields. Human // struct as embedded field Skills // string slice as embedded field int // built-in type as embedded field - speciality string + specialty string } func main() { // initialize Student Jane - jane := Student{Human:Human{"Jane", 35, 100}, speciality:"Biology"} + jane := Student{Human:Human{"Jane", 35, 100}, specialty:"Biology"} // access fields fmt.Println("Her name is ", jane.name) fmt.Println("Her age is ", jane.age) fmt.Println("Her weight is ", jane.weight) - fmt.Println("Her speciality is ", jane.speciality) + fmt.Println("Her specialty is ", jane.specialty) // modify value of skill field jane.Skills = []string{"anatomy"} fmt.Println("Her skills are ", jane.Skills) @@ -196,7 +196,7 @@ Go use a very simple way to solve it. The outer fields get upper access levels, type Employee struct { Human // embedded field Human - speciality string + specialty string phone string // phone in employee }