+ 4
Swift 4
class MarksStruct { var mark: Int init(mark: Int) { self.mark = mark } } class studentMarks { var mark = 300 } let marks = studentMarks() print("Mark is \(marks.mark)") why class is declared twice? are we connecting to the first one?
1 Respuesta
+ 1
I don't see declare twice of class in your code. You mean 'marks.mark' ? If so, you just use the marks instance of studentMarks class and access its variable 'mark' using dot notation.
Output will be 300.