Documentation ¶
Overview ¶
Package animals provides a simple abstraction for representing animals.
I'm so sorry this is basic and contrived. I'm not a zoologist.
Index ¶
Constants ¶
View Source
const IS_ANIMAL = true
This is not used at all. I just put this here so the docs don't feel lonely
Variables ¶
Functions ¶
func ShowAnimal ¶
func ShowAnimal(animal Animal)
Types ¶
type Animal ¶
type Animal interface {
Display()
}
Animal is an interface that defines the behavior of an animal. It's used to demonstrate how interfaces work in Go during the workshop. I completely understand that this is a contrived example and that animals in real life don't have a Display method.
type Dog ¶
Dog is a representation of a dog and contains a name, age, and breed. Don't use this type directly, use NewDog instead.
func NewDog ¶
NewDog creates a new instance of Dog with the specified values.
- name - a unique name for this dog; common names include 'fido' and 'max'.
- age - the current age of the dog. Must be greater than zero.
- breed - the breed of the dog. Use the DogBreed constants to specify the breed.
type DogBreed ¶
type DogBreed int
func FromString ¶
func (DogBreed) MarshalJSON ¶ added in v0.1.14
func (*DogBreed) UnmarshalJSON ¶ added in v0.1.14
Click to show internal directories.
Click to hide internal directories.