iface: improved example
This commit is contained in:
@@ -1,11 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
type Strummer interface {
|
|
||||||
Strum()
|
|
||||||
}
|
|
||||||
|
|
||||||
type Bocchi struct {
|
|
||||||
Guitar string
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ Strummer = (*Bocchi)(nil)
|
|
3
iface/chord.go
Normal file
3
iface/chord.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
type Chord string
|
13
iface/guitarist.go
Normal file
13
iface/guitarist.go
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
type Guitarist interface {
|
||||||
|
Strum(chord Chord)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Bocchi struct {
|
||||||
|
Guitar string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *Bocchi) Strum(chord string) {}
|
||||||
|
|
||||||
|
var _ Guitarist = (*Bocchi)(nil)
|
Reference in New Issue
Block a user