Last active
May 21, 2018 18:42
-
-
Save dineshba/dc2abc37b00d38467d3a7112629a18d0 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
class Dog { | |
var name: String | |
var weight: Int | |
// constructor or initializer | |
init(name: String, weight: Int) { | |
self.name = name | |
self.weight = weight | |
} | |
} | |
var myDog = Dog(name: "Ranger", weight: 10) | |
var yourDog = myDog // reference copy | |
yourDog.name = "Puncher" | |
print(myDog.name) // "Puncher" | |
print(yourDog.name) // "Puncher" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment