fr
fr

Question from the Go test

Waiting for validation

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: Waiting for validationQuestion not yet passed
0
Community EvaluationsNo one has reviewed this question yet, be the first!