March 2020
Intermediate to advanced
406 pages
8h 39m
English
Go's interfacing system is different from the interfacing systems in other languages. They are named collections of methods. Interfaces are important in composing readable Go code because they make the code scalable and flexible. Interfaces also give us the ability to have polymorphism (providing a single interface to items with different types) in Go. Another positive aspect of interfaces is that they are implicitly implemented—the compiler checks that a specific type implements a specific interface.
We can define an interface as follows:
type example interface {foo() intbar() float64}
If we want to implement an interface, all we need to do is implement the methods that are referenced in the interface. The compiler ...
Read now
Unlock full access