//
泛型函数
func repeat<ItemType>(item:ItemType,count:Int)->[ItemType] {
var result = [ItemType]();
for i in 0..<count {
result.append(item);
}
return result;
}
var re = repeat("zxh",4);
println(re);
//泛型枚举
enum OPtion<T>{
case None
case Some(T)
}
var op:OPtion<Int> = .None;
op = .Some(100);
//泛型类
class ca<T>{
var v:T;
init(val:T){
v = val;
println(v);
}
}
var caval = ca<Double>(val: 2.2);