Skip to content

Glossary: Software Design Patterns in Go

Has-a / is-a

Also written: has-a, is-a

The two ways to relate types. "Is a" is inheritance (a promo card is a gift card; Go has none), and "has a" is composition (a product has a pricing rule). If the answer is "has a", compose.

Where the book teaches it

Related terms

CompositionEmbedding