var a = 1;
var b = a;
a=2;
println("\(a),\(b)");//2,1
struct cs{
var v:Int = 99;
}
var i = cs();
var j = i;
i.v = 98;
println("\(i.v),\(j.v)");//98,99
class ca{
var v:Int;
init(var a:ca){//拷贝构造实现传值
self.v = a.v;
}
init(){
v = 100;
}
}
var x = ca();
var y = x;
var z = ca(a: x);
x.v = 200;
println("\(x.v),\(y.v),\(z.v)");//200,200,100
//Int、struct是copy,class是引用