Created
July 7, 2014 19:54
-
-
Save owensd/eb5a9f9f155a95be7aad to your computer and use it in GitHub Desktop.
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
struct SPerson { | |
var name: String | |
init(_ name: String) { self.name = name } | |
} | |
class CPerson { | |
var name: String | |
init(_ name: String) { self.name = name } | |
} | |
let sperson = SPerson("David") | |
sperson.name = "Frank" // compiler error | |
let cperson = CPerson("David") | |
cperson.name = "Frank" // this is ok, I want a way to express immutatibility on the class instance just as the struct |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment