Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Last active June 10, 2018 06:19
Show Gist options
  • Save pgpt10/4c4cb2752147fd396c6994f603e8d04b to your computer and use it in GitHub Desktop.
Save pgpt10/4c4cb2752147fd396c6994f603e8d04b to your computer and use it in GitHub Desktop.
class Address
{
var city: String?
init(_ city: String?)
{
self.city = city
}
}
var a1 = Address("Mumbai")
var a2 = a1 //This will create a Shallow Copy of a1
print(a1.city) //Mumbai
print(a2.city) //Mumbai
a2.city = "Bangalore"
print(a1.city) //Bangalore
print(a2.city) //Bangalore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment