daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top