Created
April 29, 2016 14:14
-
-
Save thanhluu/2d402f94841bf1b3635dcae3a52ba69f to your computer and use it in GitHub Desktop.
Bai Tap Struct
This file contains hidden or 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 User { | |
var fullName: String | |
var email: String | |
var age: Int | |
} | |
var someUser = User(fullName: "Thanh Luu", email: "[email protected]", age: 27) | |
var anotherUser = someUser | |
someUser.email = "[email protected]" | |
someUser.email | |
anotherUser.email | |
class Person { | |
var fullName: String | |
var email: String | |
var age: Int | |
init(name: String, email: String, age: Int) { | |
self.fullName = name | |
self.email = email | |
self.age = age | |
} | |
} | |
var somePerson = Person(name: "Tim cook", email: "[email protected]", age: 54) | |
var anotherPerson = somePerson | |
somePerson.email = "[email protected]" | |
somePerson.email | |
anotherPerson.email | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment