简体   繁体   中英

Why this sub is valid? Why i can pass each Type (String, Interface, Int) to a sub without compiler error as parameter

Public Class MainWindow

    Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded

        Me.x(1)
    End Sub

    Public Sub x(ByVal x As String)
        MessageBox.Show(x)
    End Sub

End Class

If I want a Interface in sub x as example Public sub x(Byval IPerson) it also accept every type without an error.

在VS2013中,在“调试/调试/项目和解决方案/ VB默认值”下,是一个选项,用于将“严格选项”设置为打开。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM