Search⌘ K
AI Features

Non-Exported Fields

Explore how Go handles non-exported struct fields by using getter and setter methods to access and modify internal data. Understand the importance of encapsulation in Go, learn why direct field access can cause errors, and see practical examples of how to work with struct fields across packages.

Methods and non-exported fields

How can we change, or even read the name of the object of a user-defined type in another program? This is accomplished using a well-known technique from OO-languages: provide ...