麻烦解释这个程序Private Sub pl(x As Integer,ByVal y As Integer)x = 4:y = 5:z = 6End SubPrivate Sub Command1_Click()Dim x As Integer,y As Integerx = 1:y = 2:z = 3Print x,y,zCall pl(y,z)Print x,y,zEnd Sub

问题描述:

麻烦解释这个程序
Private Sub pl(x As Integer,ByVal y As Integer)
x = 4:y = 5:z = 6
End Sub
Private Sub Command1_Click()
Dim x As Integer,y As Integer
x = 1:y = 2:z = 3
Print x,y,z
Call pl(y,z)
Print x,y,z
End Sub

Private Sub pl(x As Integer,ByVal y As Integer) '不加任何修饰符号就默认是ByRef'byval表示按值传递,过程内对这个变量的值做任何改动,byref表示按引用传递,过程内对这个变量的改动会影响调用它的过程里的变量的值...