7. 埋め込み type Hoge struct { N int } type Piyo struct { Hoge M int } func main() { piyo := &Piyo{Hoge{1}, 2} fmt.Println(piyo.N, piyo.M) fmt.Println(piyo.Hoge.N, piyo.M) } 8. 埋め込みを使ったインタフェースの実装 type Hoge interface { A() B() } type Fuga struct{ *Piyo } func (f *Fuga) A() { fmt.Println("Fuga A") } type Piyo struct{} func (p *Piyo) B() { fmt.Println("Piyo B") } func main() { var hoge Hoge = &Fuga{&Piyo
![Iketeru Gopher 5 points](https://cdn-ak-scissors.b.st-hatena.com/image/square/cabda91fcfa342d8aa9442cee1033264d821d227/height=288;version=1;width=512/https%3A%2F%2Fcdn.slidesharecdn.com%2Fss_thumbnails%2Fgopher5-140617063838-phpapp01-thumbnail.jpg%3Fwidth%3D640%26height%3D640%26fit%3Dbounds)