Methods attach to named types, not classes. Embedding a type into a struct promotes its fields and methods, giving reuse without inheritance. Explicit delegation remains available, and there is no method overriding — the outer method simply shadows.
← Go theorytheory 0/50 · 0%
Types · easy
12. Methods and Embedding
Composition instead of inheritance.
Check your understanding
1. Go achieves reuse through…
2. Embedded methods are…