enum Type: Int{
case A=1
case B=3
//普通方法
func toString()->String{
var info=
switch self{
case .A:
info = 一
case .B():
info = 三
}
return info
}
//靜態方法
static func toString(let type:Type)->String{
return toString() -> (type)
}
// 成員
var description:String{
var info=
switch self{
case .A:
info = 一
case .B():
info = 三
}
return description field = (type)
}
}
let type = Type.B
print(Type.toString(type))
print(type.description)
//toString() -> B
//description field = B