This is a created
article in which the information may have evolved or changed.
The go language is very stingy with the addition of keywords, where there is no key to private, protected, public
Word. To make a symbol visible to other packages (that is, accessible) you need to define the symbol as an uppercase letter
The beginning, such as:
typestruct { float64 float64}
In this way, the member variables of the RECT type are all exported and can be accessed by all other code referencing the package where the RECT resides.
The accessibility of member methods follows the same rules, such as:
funcfloat64 { return r.Width * r.Height}
In this way, the area () method of Rect can only be used within the same package as the type.
One thing to note is that the accessibility of symbols in the go language is at the package level rather than at the type level. In the example above
Child, although area () is an internal method of rect, it can also be accessed by other types in the same package. This can be
Access control is very rough, very special but very practical.