github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2015/go4cpp/embedding.go (about) 1 // +build OMIT 2 3 package main 4 5 import "fmt" 6 7 type Engine struct{} 8 9 func (e Engine) Start() { 10 fmt.Println("Engine started") 11 } 12 13 func (e Engine) Stop() { 14 fmt.Println("Engine stopped") 15 } 16 17 type Car struct { 18 Engine // Notice the lack of name // HL 19 } 20 21 func main() { 22 var c Car 23 24 c.Start() 25 c.Stop() 26 }