【发布时间】:2012-01-16 09:59:14
【问题描述】:
我现在在接口方面遇到了一些非常奇怪的问题。
我有一个非常简单的设置。
在我的一个班级中,我有一个 Property 从 Interface 实现 Property。
在我的课堂上是这样的:
Private _oForm As IForm
Public Property Form As IForm Implements IContainer.Form
Set(value As IForm)
Me._oForm = value
End Set
Get
Return Me._oForm
End Get
End Property
这是 IContainer 接口:
Public Interface IContainer
Property Form As IForm
Sub OpenScreen(p_oDataKey As DataKey, Optional ByVal p_oOpenScreenProperties As OpenScreenProperties = Nothing)
End Interface
这很简单,不是吗?根本没有复杂的实现,我好像也搞不定。
为了它,现在我的 IForm 里面什么都没有:
Public Interface IForm
End Interface
我总是得到:
Error 2 Class 'BaseContainer' must implement 'Property Form As IForm' for interface 'Common.IContainer'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.
和
Error 3 'Form' cannot implement 'Form' because there is no matching property on interface 'Common.IContainer'.
在我的整个项目中,我喜欢有几十个这样的界面,我不敢相信这个简单的界面不能工作!请在这里帮我一把:P
非常感谢!
【问题讨论】:
-
更新你的代码 sn-ps 以显示一个名为“BaseContainer”的类