Container is a standard struct with two fields: Base (of type Base) and Name (of type string).
Field and Method Promotion
The primary mechanic of an embedded field is promotion. Fields and methods belonging to the embedded type can be accessed directly on the embedding struct, bypassing the implicit field name.
PublicStruct.ExportedField is accessible from other packages, but PublicStruct.internalStruct is not.
Interface Embedding
Embedding is not restricted to concrete structs. Interfaces can embed other interfaces to construct composite method sets, and structs can embed interfaces to satisfy interface requirements dynamically at runtime.
Tired of Poor Go Skills? Fix That With Deep Grasping!Learn More





