Skip to content

Instantly share code, notes, and snippets.

@creynders
Created March 15, 2013 13:05
Show Gist options
  • Save creynders/5169757 to your computer and use it in GitHub Desktop.
Save creynders/5169757 to your computer and use it in GitHub Desktop.
package passByReference
{
/**
* @author creynder
*/
public class PassByReference{
public function PassByReference()
{
var receiver : Receiver = new Receiver();
trace( receiver.counter ); //outputs "1"
setCounter( receiver );
trace( receiver.counter ); //outputs "10"
}
private function setCounter( receiver : Receiver ) : void{
receiver.counter = 10;
}
}
}
internal class Receiver{
public var counter : int = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment