Go Tutorial #8: Interfaces and Polymorphism
In the previous tutorial, you learned about structs, methods, and composition. Now it is time to learn about interfaces — one of Go’s most powerful features. Interfaces in Go are different from most languages. There is no implements keyword. If a type has the right methods, it automatically satisfies the interface. This is called implicit implementation. What is an Interface? An interface defines a set of method signatures. Any type that implements all those methods satisfies the interface: ...