Skip to content

Instantly share code, notes, and snippets.

@owensd
Created July 7, 2014 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owensd/eb5a9f9f155a95be7aad to your computer and use it in GitHub Desktop.
Save owensd/eb5a9f9f155a95be7aad to your computer and use it in GitHub Desktop.
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