2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-17 09:25:32 +00:00
cheat.sheets/sheets/_go/Interfaces
2017-05-28 21:17:32 +00:00

14 lines
305 B
Plaintext

// interface declaration
type Awesomizer interface {
Awesomize() string
}
//
// types do *not* declare to implement interfaces
type Foo struct {}
//
// instead, types implicitly satisfy an interface
// if they implement all required methods
func (foo Foo) Awesomize() string {
return "Awesome!"
}