I found this example in an online video and I can't really grasp its importance and what is happening behind the scene:
class Person {
private var _name: String!
var name: String {
return _name
}
init(name: String){
_name = name
}
}
In the video he mentions that private variables are meant to prevent classes from manipulating the data, but I can't understand why that would be a problem and how it would even happen.
Can someone please explain this to me like i'm 5?
Thanks for the help