Skip to content

Instantly share code, notes, and snippets.

@madflojo
Created February 13, 2021 19:49
Show Gist options
  • Save madflojo/ebf22ea59b3f368d18b6f6736cbf1d02 to your computer and use it in GitHub Desktop.
Save madflojo/ebf22ea59b3f368d18b6f6736cbf1d02 to your computer and use it in GitHub Desktop.
Interface Article - Speaking English
package main
import (
"fmt"
)
type Speak interface {
SayHello() string
}
type English struct{}
func (e English) SayHello() string {
return "Hello"
}
func main() {
var voice Speak
// Say Hello in English
voice = English{}
fmt.Println(voice.SayHello())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment