2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-07 09:20:22 +00:00
cheat.sheets/sheets/go/Interfaces
2017-05-08 20:27:00 +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!"
}