我试图找到已经发布的类似问题,但只是对我发现的内容感到困惑。
我的情况涉及以下对象:-
报告包含参数
文档包含参数
报告和文档参数相似
查询包含参数
报告、文档和查询都具有相似的参数
所以我创建了以下类结构:-
Public MustInherit Class clsBaseCollection(Of TclsBaseChild As clsBase, TclsBaseParent As clsBase)
Public MustInherit Class clsParams(Of TclsParam As clsParam, TclsRootObject As clsRootObject)
Inherits clsBaseCollection(Of TclsParam, TclsRootObject)
Public MustInherit Class clsRepDocParams(Of TclsRepDocParam As clsRepDocParam, TclsReportDocument As clsReportDocument)
Inherits clsParams(Of TclsRepDocParam, TclsReportDocument)
Public Class clsReportParams
Inherits clsRepDocParams(Of clsReportParam, clsReport)
Public MustInherit Class clsReportDocument
MustOverride ReadOnly Property Parameters() As clsRepDocParams(Of clsRepDocParam,clsReportDocument)
Public Class clsReport
Inherits clsReportDocument
Private _Params As clsReportParams
Public Overrides ReadOnly Property Parameters() As clsReportParams
Get
If _Params Is Nothing Then
BeginUpdate()
_Params = New clsReportParams(Me)
EndUpdate()
End If
Return _Params
End Get
End Property
最后一个属性产生以下错误:-
'Public Overrides ReadOnly Property Parameters As clsReportParams' 不能覆盖 'Public MustOverride ReadOnly Property Parameters As clsRepDocParams(Of clsRepDocParam, clsReportDocument)' 因为它们的返回类型不同。
我不明白这是怎么回事,因为我相信我的等级是正确的!?
对缺少选项卡格式表示歉意...我是堆栈溢出站点的新手,希望我会改进;)
干杯杰夫