Welcome to Phrogram Sign in | Join | Help


Rules for how variables are passed to functions/methods?

  •  12-20-2006, 7:20 AM

    Rules for how variables are passed to functions/methods?

    I'm an old C/C++ programmer so I apologize in advance if this questions is common knowledge to all the Visual Basic developers out there...

    I've gotten tripped up a few times when a variable was passed to a function/method by reference rather than by value. I've noticed that simple variables (integer, decimal, etc.) seem to be passed by value but complex variables (classes, etc.) are passed by reference.  Also, what's allocated when a complex variable is defined?  Is it fully instantiated or is just a pointer allocated?  In the expression "x = y" will x end up being a copy of y or will it simply "point" to y?

    What's going on "behind the scenes"?  Is there a syntax spec for Phrogram that defines the  expected behavior?

    Thanks

    Bob
     

View Complete Thread