Skip to content

Glossary: Software Design Patterns in Go

Embedding

Also written: embedded type, struct embedding, promoted

Listing a type inside a struct with no field name so the outer type gets its fields and methods promoted. It is Go's nearest thing to inheritance, but the inner type's methods can't be overridden from outside.

Where the book teaches it

Related terms

CompositionFragile base classHas-a / is-a