Skip to content

Instantly share code, notes, and snippets.

@miladvafaeifard
Created November 23, 2018 17:45
Show Gist options
  • Save miladvafaeifard/7444587b2d2148723a456f67c61dda06 to your computer and use it in GitHub Desktop.
Save miladvafaeifard/7444587b2d2148723a456f67c61dda06 to your computer and use it in GitHub Desktop.
test golang
package main
import "fmt"
type Person interface {
getName() string
}
func (e Employee) getName() string {
return e.name
}
type Employee struct {
name string
age int
}
func main() {
people := []Person{
Employee{"Milad", 23},
Employee{"Sara", 31},
}
for _, p := range people {
fmt.Println("Hello " + p.getName())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment