Abstract type: Difference between revisions

Line 1,105:
A variable of an interface type can hold a value of any type that implements the methods that are specified in the interface. You don't need to explicitly "declare" that the type "implements" the interface or anything like that -- the compatibility is purely structural based on the methods.
 
::<lang go>package main
 
import "fmt"
Anonymous user