例如,假设我有一个类测试
Private TimeToExpiry as Double
Property Let theTimeToExpiry(ByVal value as Double)
TimeToExpiry = value
End Property
Property Get theTimeToExpiry() As Double
theTimeToExpiry = TimeToExpiry
End Property
然后我可以创建一个测试对象并设置TimeToExpiry的值并将其用作常规变量
Dim te as test
Set te as New test
te.TimeToExpiry = 1.0
为什么我不像这样做测试课
Public TimeToMaturity as Double
然后我还可以通过创建测试对象来设置TimeToMaturity的值
Dim te as test
Set te as New test
te.TimeToExpiry = 1.0
我的问题是它们有什么区别?为什么第一个更好?