mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-07 09:20:22 +00:00
14 lines
305 B
Plaintext
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!"
|
|
}
|