fr
fr

Question from the Go test

Medium

In the code below, how does ChildEvent reuse the fields of ParentEvent?

package main

import "fmt"

type ParentEvent struct {
	IsSet bool
}

type ChildEvent struct {
	ParentEvent
}

func main() {
	event := ChildEvent{
		ParentEvent: ParentEvent{
			IsSet: true,
		},
	}
	fmt.Println(event)
}

Author: John PendenqueStatus: PublishedQuestion not yet passed
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!