Created
June 10, 2020 13:42
-
-
Save stevencurtis/bfc1c5eb5a8de03b1c98d6e4067a5324 to your computer and use it in GitHub Desktop.
personset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
private (set) var name: String | |
var age: Int | |
init(name: String, age: Int) { | |
self.name = name | |
self.age = age | |
} | |
} | |
let imani = Person(name: "Imani", age: 45) | |
imani.age = 46 | |
print (imani.name) | |
imani.name = "Roger" // cannot assign to property: 'name' setter is inaccessible |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment