Last active
October 16, 2015 19:38
-
-
Save svalleru/37a3552296f338ff48c1 to your computer and use it in GitHub Desktop.
Simplae Interface & Struct in Go
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 Awesomizer interface { | |
| Awesomize() string | |
| } | |
| type Foo struct{} | |
| func (foo Foo) Awesomize() string { | |
| return "Awesome!" | |
| } | |
| func main() { | |
| f := Foo{} | |
| fmt.Println(f.Awesomize()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment