package main
import (
"fmt"
)
type IA interface {
Parse()
Name() string
}
type A struct {
IA
}
func (a *A) Name() string {
return "AName"
}
func (a *A) Parse() {
fmt.Println("A-" + a.Name())
}
type B struct {
A
}
func (b *B) Name() string {
return "BName"
}
func main() {
a := &A{}
b := &B{}
a.Parse()
b.Parse() // I would like to see "A-BName"
}
When I execute method from inherited struct with execute another struct method in it - is executed method from inherited struct, not actual object type.