forked from ardanlabs/gotraining
-
Notifications
You must be signed in to change notification settings - Fork 0
/
toy.go
24 lines (17 loc) · 889 Bytes
/
toy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// All material is licensed under the Apache License Version 2.0, January 2004
// http://www.apache.org/licenses/LICENSE-2.0
// Package toy contains support for managing toy inventory.
package toy
// Declare a struct type named Toy with four fields. Name string,
// Weight int, onHand int and sold int.
// Declare a function named New that accepts values for the
// exported fields. Return a pointer of type Toy that is initialized
// with the parameters.
// Declare a method named OnHand with a pointer receiver that
// returns the current on hand count.
// Declare a method named UpdateOnHand with a pointer receiver that
// updates and returns the current on hand count.
// Declare a method named Sold with a pointer receiver that
// returns the current sold count.
// Declare a method named UpdateSold with a pointer receiver that
// updates and returns the current sold count.