Created
March 7, 2022 07:38
-
-
Save oofnivek/45a7eaab40f3901249f534677856d62e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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