当我尝试将字符串(testString = "10"
)参数传递给带有货币参数(ByVal newCash as Currency
)的属性时,为什么它不会失败?我不希望这种自动转换。怎么预防呢?如何禁用它?
Model
课程模块
Option Explicit
Private m_cash As Currency
Public Property Let Cash(ByVal newCash As Currency)
m_cash = newCash
End Property
Test
课程模块
Option Explicit
Public Sub Test()
Dim modelObj as Model
Dim testString as String
Set modelObj = New Model
testString = "10"
modelObj.Cash = testString
End Sub