Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Created Unassigned: Class Variable passed byval is adjusted in Sub [28]

$
0
0
Passing a variable (Class) to a sub and using the passed variable to make changes results in the calling routine having its copy adjusted suggesting that BYVAL is not being used for Class objects.

Example Code

```
Class Switch
Public Name
Public IP
End Class

sub Test(byval lsw)
lsw.Name = "From Sub"
end sub

set LSwitch = new Switch
LSwitch.Name = "Outside"
writeline("Name : " & LSwitch.Name)
Test LSwitch
writeline("Name : " & LSwitch.Name)
```
Resulting Output :
```
Name : Outside
Name : From Sub
```

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>