关于类的问题
Class A:
=============================
Option Explicit
Public x As ClassB
Class B:
=============================
Option Explicit
Public strName As String
Form1
==============================
Dim A As New ClassA
Dim B As New ClassB
Private Sub Command1_Click()
B.strName = "abc "
Set A.x = B
MsgBox A.x.strName
B.strName = "new data "
MsgBox A.x.strName
End Sub
为什么A.x.strName不是原来的 abc 而是随着b.strName的改变而改变阿?
[解决办法]
类对象只能引用
classA
-----------------
public x as classB
public property set X(t as classB)
set x=new classB
x.strName=t.strName
end property