僕はGoのstructとinterfaceの関係がよくわかってないらしいのがわかったんだけどどうすればわかるかねえ…
ぴったしのページがあったw
Structs and Interfaceshttps://www.golang-book.com/books/intro/9
Shapeの配列の構造体リテラルむずかしいなw
type MultiShape struct { shapes []Shape}
:
r := Rectangle{x1: 0, y1: 0, x2: 10, y2: 10} c := Circle{x: 0, y: 0, r: 5} m := MultiShape{[]Shape{&r, &c}}
Mastodon is the best way to keep up with what's happening.
Follow anyone across the fediverse and see it all in chronological order. No algorithms, ads, or clickbait in sight.