摘要: package main import ( "fmt" "math" ) //自定义结构体错误,实现error接口 type InvaildradiusError struct { radius float64 Minradius float64 Maxreaius float64 } //封装工厂方法 func NewInvaildradi... 阅读全文
posted @ 2019-07-30 17:51 pad+ 阅读(158) 评论(0) 推荐(0) 编辑
摘要: package main import ( "errors" "fmt" "math" ) func GetToyBallvolume2 (redius float64)(volume float64,err error) { if redius 50 { err = errors.New("取值范围需要在[5,50]") ... 阅读全文
posted @ 2019-07-30 11:00 pad+ 阅读(109) 评论(0) 推荐(0) 编辑