struct Struct{
var point = 0
}
var structPosition = Struct()
var structPosition2 = structPosition
structPosition2.point = 10
print(structPosition.point) //0
print(structPosition2.point) //10
class Class{
var point = 0
}
var classPosition = Class()
var classPosition2 = classPosition
classPosition2.point = 10
print(classPosition.point) //10
print(classPosition2.point) //10
Class與Struct有很多相似的地方,要如何決定每個資料建構要定義為哪個
以上情況都符合定義Struct,而其他資料結構可定義為Class