Last active
September 11, 2017 01:28
-
-
Save kanapuli/5e435d35012650ac74325ec3c7c929e1 to your computer and use it in GitHub Desktop.
This file contains 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 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