<pre name= "code" class= "Python" >1. There is a struct and class, defined as follows <pre name= "code" class= "java" >struct Resolution {
var width = 0
var heigth = 0
}
class Videomode {
var Resolution = Resolution ()
var interlaced = False
var framerate = 0.0
var name:string?
}
Let HD = Resolution (width:1920, height:1080)
var cinema = HD
cinema.width = 2048
println ("Cinema was now \ (cinema.width) pixels wide ")
<pre name=" code "class=" Python ">println (" HD is now \ (hd.width) pixels wide ")
Above when output statement output what separately.
Let teneighty = Videomode ()
teneighty.resolution = HD
teneighty.interlaced = true
teneighty.name = "1080i" C3/>teneighty.framerate = 25.0 let
alsoteneighty = teneighty
alsoteneighty.framerate = 30.0
println ("the Framerate property of Teneighty was now \ (teneighty.framerate) ")
above when output.
This is the difference between a value type and a reference type.