小女子刚刚学习类。。。。想写一个试试,照着别人的例子写了之后总是在let方法赋值给属性的时候提示“属性使用无效”。。。。求大侠帮忙看看 不甚感激!
类的代码:
Public X%
Public Property Get GetXValue() As Integer
GetXValue = X
End Property
Public Property Let SetXValue(ByVal SetValue As Integer)
X = SetXValue '运行的时候就在“SetXValue”处选中,然后提示“属性使用无效”!!!!
End Property
模块中的代码:
Sub TestClass()
Dim X As Integer
Dim MyClass As New TryClass
X = 5
MyClass.SetXValue = 5
Debug.Print MyClass.GetXValue
End Sub