Inheritance in Go
package main
import (
"fmt"
)
type Base struct {}
func (entity Base) DoCommonLogic() {
// ...
entity.SpecificLogic()
// ...
}
func (entity Base) SpecificLogic() {
fmt.Println("A vot huy")
}
type Child struct {
Base
}
func (entity Child) SpecificLogic() {
fmt.Println("Inherited method")
}
func main() {
(Child{Base{}}).DoCommonLogic()
}INFO