Swift Tutorial - Tutorialspoint

(backadmin) #1
let mark = 98

println(stname)
println(mark)

When we run the above program using playground, we get the following result:


swift
98

ARC Strong Reference Cycles Class Instances


class studmarks {
let name: String
var stud: student?

init (name: String) {
println("Initializing: \(name)")
self.name = name
}

deinit {
println("Deallocating: \(self.name)")
}
}

class student {
let name: String
var strname: studmarks?

init (name: String) {
println("Initializing: \(name)")
self.name = name
}

deinit {
println("Deallocating: \(self.name)")
Free download pdf