struct是值类型。这意味着,如果将结构的实例复制到另一个变量,则它只是复制到该变量。值类型示例struct Resolution { var width = 2 var height = 3}let hd = Resolution(width: 1920, height: 1080)var cinema = hd //assigning struct instance to variableprintln("Width of cinema instance is \(cinema.width)")//result is 1920println("Width of hd instance is \(hd.width)")//result is 1920cinema.width = 2048println("Width of cinema instance is \(cinema.width)")//result is 2048println("Width of hd instance is \(hd.width)")//result is 1920类是引用类型。这意味着,如果将类的实例分配给变量,则它将仅保留对该实例的引用,而不包含副本。