预期类型不匹配错误 [英] expected type mismatch error
问题描述
我期望在编译时出现 ByRef 参数类型不匹配,但我没有得到它.它编译时没有错误并且在运行时失败并显示错误 13,类型不匹配".
I'm expecting a ByRef Argument Type Mismatch at compile time but I'm not getting it. It's compiling without errors and failing at runtime with error 13, "Type mismatch".
复制起来相当简单.
dim c as Car
Set c = New Car
Sail c
...
Public Sub Sail(ByRef b As Boat)
...
End Sub
汽车不继承自船
是否有设置(或插件)可以强制 VB 进入严格的编译模式?
Is there a setting (or plugin perhaps) that will force VB into a strict compilation mode?
看起来没有编译器选项.有谁知道在编译期间分析这些铸造问题来源的插件吗?
it looks like there's no compiler option for this. Does anyone know of an addon that analyses the source for these casting issues during a compile?
推荐答案
VB6中是否可以设置Option Strict True?
Is it possible to set Option Strict True in VB6?
显然它在 VB6 中是不可能的(似乎是在 VB 7.0 中引入的)
Apparently it is not possible in VB6 (seems to have been introduced with VB 7.0)
这篇关于预期类型不匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!