Go doesn’t have a concept of class or have a class-based inheritance. Go is a bit different than the regular object-oriented languages.

How we can reuse the code if Inheritance is not there?

Go has a unique feature called embedded fields in the struct(More like composition). Using those we can reuse the code, it is pretty much similar to what Inheritance provides in other languages.

#golang #inheritance #design-patterns #go #embedded-fields-in-go

Inheritance in Go
1.85 GEEK