上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 40 下一页
摘要: Package imagedefines theImageinterface:package imagetype Image interface { ColorModel() color.Model Bounds() Rectangle At(x, y int) color.Col... 阅读全文
posted @ 2014-10-28 22:59 wuhn 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Implement the following types and define ServeHTTP methods on them. Register them to handle specific paths in your web server.type String stringtype S... 阅读全文
posted @ 2014-10-28 22:57 wuhn 阅读(454) 评论(0) 推荐(0) 编辑
摘要: Package httpserves HTTP requests using any value that implementshttp.Handler:package httptype Handler interface { ServeHTTP(w ResponseWriter, r *Re... 阅读全文
posted @ 2014-10-28 22:47 wuhn 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Copy yourSqrtfunction from the earlier exercises and modify it to return anerrorvalue.Sqrtshould return a non-nil error value when given a negative nu... 阅读全文
posted @ 2014-10-28 20:41 wuhn 阅读(554) 评论(0) 推荐(0) 编辑
摘要: An error is anything that can describe itself as an error string. The idea is captured by the predefined, built-in interface type,error, with its sing... 阅读全文
posted @ 2014-10-28 20:23 wuhn 阅读(133) 评论(0) 推荐(0) 编辑
摘要: A type implements an interface by implementing the methods.There is no explicit declaration of intent.Implicit interfaces decouple implementation pack... 阅读全文
posted @ 2014-10-28 20:08 wuhn 阅读(238) 评论(0) 推荐(0) 编辑
摘要: An interface type is defined by a set of methods.A value of interface type can hold any value that implements those methods.Note:The code on the left ... 阅读全文
posted @ 2014-10-28 20:00 wuhn 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Methods can be associated with a named type or a pointer to a named type.We just saw twoAbsmethods. One on the*Vertexpointer type and the other on the... 阅读全文
posted @ 2014-10-28 19:34 wuhn 阅读(275) 评论(0) 推荐(0) 编辑
摘要: In fact, you can define a method onanytype you define in your package, not just structs.You cannot define a method on a type from another package, or ... 阅读全文
posted @ 2014-10-28 18:59 wuhn 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Go does not have classes. However, you can define methods on struct types.Themethod receiverappears in its own argument list between thefunckeyword an... 阅读全文
posted @ 2014-10-28 18:54 wuhn 阅读(111) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 40 下一页