Fix typos in c2.4 of the English version
This commit is contained in:
@@ -133,9 +133,9 @@ Let's see one example.
|
||||
|
||||

|
||||
|
||||
Figure 2.7 Inheritance in Student and Human
|
||||
Figure 2.7 Embedding in Student and Human
|
||||
|
||||
We see that we can access the age and name fields in Student just like we can in Human. This is how embedded fields work. It's very cool, isn't it? Hold on, there's something cooler! You can even use Student to access Human in this embedded field!
|
||||
We see that we can access the `age` and `name` fields in Student just like we can in Human. This is how embedded fields work. It's very cool, isn't it? Hold on, there's something cooler! You can even use Student to access Human in this embedded field!
|
||||
|
||||
mark.Human = Human{"Marcus", 55, 220}
|
||||
mark.Human.age -= 1
|
||||
@@ -176,7 +176,7 @@ All the types in Go can be used as embedded fields.
|
||||
fmt.Println("Her skills now are ", jane.Skills)
|
||||
// modify embedded field
|
||||
jane.int = 3
|
||||
fmt.Println("Her preferred number is", jane.int)
|
||||
fmt.Println("Her preferred number is ", jane.int)
|
||||
}
|
||||
|
||||
In the above example, we can see that all types can be embedded fields and we can use functions to operate on them.
|
||||
|
||||
Reference in New Issue
Block a user