While there is no classic inheritance using keyswords like "implements" we can embed structs in other structs:
type Car struct {
Brand string
}
func (c Car) Drive() string {
return "vroom"
}
type Porsche struct {
Car
}
While there is no classic inheritance using keyswords like "implements" we can embed structs in other structs:
type Car struct {
Brand string
}
func (c Car) Drive() string {
return "vroom"
}
type Porsche struct {
Car
}