尝试在vb.net中实现接口时出现此错误:
Public Interface IFoo
ReadOnly Property Foo() As String
End Interface
Public Class myFoo
Implements IFoo
Public ReadOnly Property Foo() As String
Get
return "Foo"
End Get
End Property
...
End Class
Run Code Online (Sandbox Code Playgroud)
缺什么?
Fre*_*örk 20
您将要告诉代码myFoo.Foo
实现IFoo.Foo
(注意添加Implements IFoo.Foo
):
Public Interface IFoo
ReadOnly Property Foo() As String
End Interface
Public Class myFoo
Implements IFoo
Public ReadOnly Property Foo() As String Implements IFoo.Foo
Get
Return "Foo"
End Get
End Property
End Class
Run Code Online (Sandbox Code Playgroud)
据我所知,VB.NET不支持隐式接口实现,就像C#一样.