var mark: Int
var mark2: Int
}
The syntax for creating instances
let studrecord = student()
Example
class MarksStruct {
var mark: Int
init(mark: Int) {
self.mark = mark
}
}
class studentMarks {
var mark = 300
}
let marks = studentMarks()
println("Mark is \(marks.mark)")
When we run the above program using playground, we get the following result:
Mark is 300
Accessing Class Properties as Reference Types
Class properties can be accessed by the '.' syntax. Property name is separated by a '.'
after the instance name.
class MarksStruct {
var mark: Int
init(mark: Int) {
self.mark = mark
}
}
class studentMarks {