go 不定参数函数
摘要:不定参数函数 在Go语言中,能够传递可变数量的参数,但它们的类型必须与函数签名指定的类型相同。要指定不定参数,可使用3个点(…) demo package main import "fmt" // 数字求和函数 不定参数 func AddNumbers(numbers ...int) (sum in
阅读全文
golang 接口interface 多态
摘要:多态就是多重形态。 案例: 收入的案例: package main import ( "fmt" ) type Income interface { calculate () float64 source() string } //固定账单项目 type FixedBuilding struct {
阅读全文