返回的是“编译错误:为同一属性的属性过程定义不一致,或财产过程有一个可选参数,ParamArrary,或无效的参数设定”。房产类型VBA对象
我明白这是什么错误,但只是不明白为什么给它是如此简单,遗憾和感谢希望:
Private natural_persons As Collection
Private suspicous_reports As cls_SR
Private legal_persons As Collection
Private Sub Class_Initialize()
Set natural_persons = New Collection
End Sub
Public Property Let natural_person(S As cls_NP)
natural_persons.Add (S)
End Property
Public Property Get natural_person(S As Integer) As cls_NP
natural_person = natural_persons(S)
End Property
Public Property Let suspicous_report(S As cls_SR)
suspicous_reports = S
End Property
Public Property Get suspicous_report() As cls_SR
suspicous report = suspicous_reports
End Property
Public Property Let legal_person(S As cls_LP)
legal_persons.Add S
End Property
Public Property Get legal_person(S As Integer) As cls_LP
legal_person = legal_persons(S)
End Property
对象类型属性需要'Set'来代替'Let',并且在分配返回值时还需要使用'Set'。缺少下划线这里'suspicous报告= suspicous_reports' –
此外,你并不需要在'natural_persons.Add(S)围绕'S'括号' – ThunderFrame