私はVB6で再帰的な関数を持っています。関数をフレンド関数にしてどこからでも手に入れることはできませんが、機能しません。関数をpublic関数に変更すると、オブジェクトは存在しないとしか言いません。どうして?友人機能がどのように働いているのか誤解していませんか?私の再帰的な友人機能がVB6で動作しないのはなぜですか?
コードは次のようになります。私はちょうどそれが動作する公衆に機能を変更した場合は
Friend Function TestFunction() As Boolean
On Error GoTo ErrHandler
TestFunction= False
If Me.Works Then
TestFunction= True
End If
If TestFunction = False And Me.HaveChild = True Then
Dim objClass
For Each objClass In Me.colChild
If objClass.TestFunction = True Then 'I get the break here, due to missing object
TestFunction = True
Exit For
End If
Next
End If
Exit Function
ErrHandler:
Call LogError()
End Function
、誰かが理由を説明できますか?
colChildとは何ですか? TestFunctionが定義されている型のオブジェクトの集合ですか? – djv
はい、クラスオブジェクトのコレクションです。 –