Interfaces in Go are a powerful language construct, which allow you to define and use objects of different types under a common umbrella interface. What does that even mean? Imagine a Car, or a Motorbike. Both have a license plate. When we declare an interface with a License() string function, both Car and Motorbike objects will satisfy this interface.
package main import ( "fmt" ) type Car struct { license string } func (c *Car) Name() string { return "car" } func (c *Ca...
Published on February 28, 2018 09:20