Guest User

Untitled

a guest
Jun 13th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. )
  6.  
  7. type Animal struct {
  8. Cat string
  9. Dog string
  10. }
  11.  
  12. func newAnimal() *Animal {
  13. return &Animal {
  14. Cat: "cat",
  15. Dog: "dog",
  16. }
  17. }
  18.  
  19. type Count interface {
  20. One() string
  21. Two() string
  22. }
  23.  
  24. func(a Animal) One() string{
  25. return "one"
  26. }
  27.  
  28. func(a Animal) Two() string{
  29. return "two"
  30. }
  31.  
  32.  
  33. func main() {
  34. a := newAnimal()
  35. c := Count(a)
  36. fmt.Println(a.Cat)
  37. fmt.Println(c.One())
  38. }
Add Comment
Please, Sign In to add comment