We know the default to pass simple variable args is ByRef, so you never need to write ByRef, unless you want to be specific.
What about object variables?
According to this article by Chip Pearson, he states objects are ALWAYS passed ByRef:
Passing Variable ByRef And ByVal
Does he mean the DEFAULT is ByRef or does he mean it can ONLY be passed ByRef?
In a class, if you inserted a property using Insert - Procedure - Property, you get the following:
But some books omit the keyword ByVal, so are they he same, ie the default is ByVal? (If you added ByRef instead, does it make a difference)?
Similarly for the Set Property, if you added ByVal, or ByRef or omitted it altogether, what's the difference?
Thanks
What about object variables?
According to this article by Chip Pearson, he states objects are ALWAYS passed ByRef:
Passing Variable ByRef And ByVal
Does he mean the DEFAULT is ByRef or does he mean it can ONLY be passed ByRef?
In a class, if you inserted a property using Insert - Procedure - Property, you get the following:
Code:
Public Let Property (ByVal MyVar) As SomeType
But some books omit the keyword ByVal, so are they he same, ie the default is ByVal? (If you added ByRef instead, does it make a difference)?
Similarly for the Set Property, if you added ByVal, or ByRef or omitted it altogether, what's the difference?
Thanks
Last edited: