Skip to content

Instantly share code, notes, and snippets.

@oofnivek
Created March 7, 2022 07:38
Show Gist options
  • Save oofnivek/45a7eaab40f3901249f534677856d62e to your computer and use it in GitHub Desktop.
Save oofnivek/45a7eaab40f3901249f534677856d62e to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
type Cat struct{}
func (c Cat) Say() string { return "meow" }
type Dog struct{}
func (d Dog) Say() string { return "woof" }
func main() {
c := Cat{}
fmt.Println("Cat says:", c.Say())
d := Dog{}
fmt.Println("Dog says:", d.Say())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment