what types could be embedded?

tags: learning go programming

content

  • to begin with, it has to be a type
    • it could be custom type or built-in type
type MyStruct int
type MyStruct2 {
	A int,
	MyStruct
	int
}
  • it could also be interface
type Logger interface {
	Log()
}
type MyStruct struct {
	name string
	Logger
}

up

down

reference