← Back to archive

Stdle #175 · classes · 2026-11-28

What does this Go snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

package main
import "fmt"
type Engine struct{ HP int }
type Car struct {
*Engine
Name string
}
func main() {
c := Car{Engine: &Engine{HP: 200}, Name: "x"}
fmt.Println(c.HP, c.Name)
}
Classes
4 attempts left

Answer & explanation