赞
踩
go 里的别名和原来的类型是两种不同的类型,互相转换的方式是强制类型转换及,TypeA(b)或者TypeB(a)
type String string
func main(){
var a string = "hello"
var b String = String(a)
fmt.Println(String(a))
fmt.Println(b)
fmt.Println(string(b))
}
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。