gobuch/hello-interface/main.go
2020-08-21 06:26:40 +02:00

28 lines
360 B
Go

package main
import "fmt"
type QuasselStrippe interface {
Quassel()
}
type Person struct {
name string
}
func (p *Person) Quassel() {
fmt.Printf("Hi. Meine Name ist %s\n", p.name)
}
func VielQuasseln(qs QuasselStrippe) {
for i := 0; i < 3; i++ {
qs.Quassel()
}
}
func main() {
s := &Person{name: "Quassel-Philip"}
s.Quassel()
VielQuasseln(s)
}