Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "fmt"
- )
- type Animal struct {
- Cat string
- Dog string
- }
- func newAnimal() *Animal {
- return &Animal {
- Cat: "cat",
- Dog: "dog",
- }
- }
- type Count interface {
- One() string
- Two() string
- }
- func(a Animal) One() string{
- return "one"
- }
- func(a Animal) Two() string{
- return "two"
- }
- func main() {
- a := newAnimal()
- c := Count(a)
- fmt.Println(a.Cat)
- fmt.Println(c.One())
- }
Add Comment
Please, Sign In to add comment