Despite supporting object-oriented programming and containing types and functions, there is no type hierarchy in Go. This contrasts with most object-oriented languages, including Python and Ruby, as well as dynamic languages like C++, Java, C#, and Scala.
Yes, you can use structures, methods, encapsulation, and inheritance in Go, but differently.
Classes in other languages fulfill comparable functions, as do structural types (methods). In Go, methods are functions that work with specific types. They have a receiver clause that specifies the type of business they can conduct.
We can embed different anonymous types inside of one another. When we embed a nameless struct, the embedded struct immediately gives the embedding struct access to its state (and methods).
Types that specify sets of methods are called interfaces. They lack implementation, much like other languages' interfaces. All-interface-method-implementing objects automatically implement the interface. There is no subclassing, inheritance, or "implements" keyword.
The package level is where Go encapsulates things. Only those names that begin with a lowercase letter are displayed in that package. In a private package, you can conceal everything and just expose particular types, interfaces, and factory functions.
Implementation inheritance is similar to composition by anonymous type embedding.
Last, any value that implements the interface can be stored in an interface variable. In Go, polymorphism is accomplished using this interface attribute.