Skip to content

Instantly share code, notes, and snippets.

@kanapuli
Last active September 11, 2017 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanapuli/5e435d35012650ac74325ec3c7c929e1 to your computer and use it in GitHub Desktop.
Save kanapuli/5e435d35012650ac74325ec3c7c929e1 to your computer and use it in GitHub Desktop.
package main
import "fmt"
type cat string
//String from type cat always meows
func (c cat) String() string {
return fmt.Sprintf("A Cat always Meows")
}
type tiger = cat
func main() {
tom := cat("Tommy")
fmt.Printf("%s\n", tom)
kan := tiger("Kan")
fmt.Printf("%s\n", kan)
}
//Output:
//go run main.go
//A Cat always Meows
//A Cat always Meows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment