摘要:
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
阅读(137)
评论(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
阅读(465)
评论(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
阅读(151)
评论(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
阅读(575)
评论(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
阅读(140)
评论(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
阅读(251)
评论(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
阅读(139)
评论(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
阅读(278)
评论(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
阅读(124)
评论(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
阅读(118)
评论(0)
推荐(0)

浙公网安备 33010602011771号