Deviopath › Go

Embedded Engine

Medium · Structs

Embedding Engine in Car promotes Engine methods: c.Start() calls Engine.Start unless Car overrides it. Car.Label() should return "brand engine" using the promoted Name() from Engine.

Write Name() on Engine and Label() on Car. RunCar(brand, engine) is already written.

Next: HTTP Status Class