2019-07-03 21:53:25 +02:00
|
|
|
struct Dog {
|
|
|
|
}
|
|
|
|
|
|
|
|
fn (d Dog) speak() {
|
|
|
|
println('dog.speak()')
|
|
|
|
}
|
|
|
|
|
|
|
|
fn (d Dog) name() string {
|
|
|
|
return 'old gray'
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Speaker {
|
|
|
|
name() string
|
2019-08-31 15:38:13 +02:00
|
|
|
speak()
|
2019-07-03 21:53:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Speak2er {
|
2019-08-31 15:38:13 +02:00
|
|
|
speak()
|
2019-07-03 21:53:25 +02:00
|
|
|
name() string
|
|
|
|
}
|
|
|
|
|
|
|
|
fn perform_speak(s Speaker) bool {
|
|
|
|
s.speak()
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test_perform_speak() {
|
|
|
|
d := Dog{}
|
|
|
|
assert perform_speak(d)
|
|
|
|
}
|
|
|
|
|