Summary
This chapter presented some fundamental and advanced topics when using interfaces. We learned that Go's implementation of interfaces has some similarities with other languages; for example, an interface does not contain the implementation details of the behaviors it is representing, and an interface is the blueprint of the methods. The different types that implement the interface can differ in their implementation details. However, Go differs in how you implement an interface compared to other languages. We learned that the implementation is done implicitly and not explicitly, like other languages.
This concludes that Go does not do subclassing, so, for it to implement polymorphism, it uses interfaces. It allows an interface type to appear in different forms, such as a Shape
interface appearing as a rectangle, square, or circle.
We also discussed a design pattern of accept interfaces and return structs. We demonstrated that this pattern allows for broader uses by...