Inheritance in Go

Run Settings
LanguageGo
Language Version
Run Command
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() }
Editor Settings
Theme
Key bindings
Full width
Lines