func AddFn(a, b int) int
func ExerciseFuncClosure(iter int, a1, a2 AddFunc, m1, m2 mult.MultFunc) int
ExerciseFuncClosure calls mostly a1 and m1.
This is a simplified version of ExerciseFuncConcrete, but we need two distinct call sites to test two different types of function values.
func ExerciseFuncConcrete(iter int, a1, a2 AddFunc, m1, m2 mult.MultFunc) int
ExerciseFuncConcrete calls mostly a1 and m1.
func ExerciseFuncField(iter int, a1, a2 AddFunc, m1, m2 mult.MultFunc) int
ExerciseFuncField calls mostly a1 and m1.
This is a simplified version of ExerciseFuncConcrete, but accessing the function values via a struct field.
func ExerciseIface(iter int, a1, a2 Adder, m1, m2 mult.Multiplier) int
ExerciseIface calls mostly a1 and m1.
func SubFn(a, b int) int
type Add struct{}
func (Add) Add(a, b int) int
type AddFunc func(int, int) int
func AddClosure() AddFunc
func SubClosure() AddFunc
type Adder interface { Add(a, b int) int }
type Sub struct{}
func (Sub) Add(a, b int) int
Name | Synopsis |
---|---|
.. |