メモメモ embedded field
<- http://golang.org/ref/spec#Struct_types
Struct types
//
A field declared with a type but no explicit field name is an anonymous field, also called an embedded field or an embedding of the type in the struct
//
// !
Given a struct type S
and a type named T
, promoted methods are included in the method set of the struct as follows:
- If
S
contains an anonymous fieldT
, the method sets ofS
and*S
both include promoted methods with receiverT
. The method set of*S
also includes promoted methods with receiver*T
. - If
S
contains an anonymous field*T
, the method sets ofS
and*S
both include promoted methods with receiverT
or*T
.