'local variable(s) to hold property value(s)
Private mvarA As String 'local copy
 Public Property Let A(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.A = 5
    mvarA = vData
End Property
Public Property Get A() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.A
    A = mvarA
End Property
------------------------------------------------------------
'local variable(s) to hold property value(s)
Private mvarA As String 'local copy
 Public Property Let A(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.A = 5
    mvarA = vData
End Property
Public Property Get A() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.A
    A = mvarA
End Propertybyval不起作用,vb6里面如何实现VB.net的clone实例?

解决方案 »

  1.   

    Private Sub Form_Load()
        Dim testA, testB, testC
        Set testA = New Class1
        ''MsgBox testA.Property(0)
        ''MsgBox CStr(testA.Class)
        testA.A = "A"
         
        Set testB = testA
        testB.A = "B"
        MsgBox testA.A
         
        Set testC = clone(testA)
        testC.A = "C"
        MsgBox testA.A
       '' testA.a=
    End SubPrivate Function clone(ByVal instance) As Class1
        Set clone = New Class1
        Set clone = instance
    End Function