Skip to content

Instantly share code, notes, and snippets.

@abhimuralidharan
Created February 20, 2017 04:54
Show Gist options
  • Select an option

  • Save abhimuralidharan/56d32366c93e1f4bd425327a47be4f1c to your computer and use it in GitHub Desktop.

Select an option

Save abhimuralidharan/56d32366c93e1f4bd425327a47be4f1c to your computer and use it in GitHub Desktop.
func someFunction(_ vehicle:Vehicle) {
vehicle.model = "Toyota Etios"
}
var ford = Vehicle()
ford.model = "Mustang"
print(ford.model) // prints "Mustang"
someFunction(ford) // value changed on the real object as objects are pass by reference.
print(ford.model) // prints "Toyota Etios"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment