go 方法
2016-05-13 10:39
666 查看
package main import "fmt" type mystring string func (self mystring)String()string{ return string(self) } func (self mystring) show(){ self = "hi" fmt.Println(self) } func (self *mystring) show2(){ *self = "hi" fmt.Println(self) } func main(){ var str = mystring("hello") var pstr = &str str.show() fmt.Println(str) //str.show2() panic pstr.show() fmt.Println(str) pstr.show2() fmt.Println(str) }
相关文章推荐
- mac修改host文件,让你的mac轻松上google
- django 基础入门(二)
- Fusion Tables 图层用于呈现 Google Fusion Tables 中包含的数据
- Django基础(二)—— models
- 多边形glPolygonMode glFrontFace glCullFace glPolygonStipple
- google-hosts
- googleNet
- 普元部署多个应用的方法(适用EOS6.5以上版本,且无需governor中添加应用)
- Google Map 符号
- Beego下如何使用captcha生成验证码
- 如何登陆google
- 如何登陆google
- 如何登陆google
- 如何登陆google
- 如何登陆google
- 如何登陆google
- 如何登陆google
- 如何登陆google
- 如何登陆google
- 如何登陆google