有没有人建过VB6 子类的
因为原本程式内已经有个类了〜可是应使用者需求要加入功能〜但是放在一起太复杂了〜想切成两个子类〜
不知道版上大神有没有能提供一个简单的示例代码〜
让我理解一下父类与子类和表单之间的关系〜
光一个类就将近1万5千行了〜要加入此功能估计要变3万行〜
想切割一下代码量〜
[此贴子已经被作者于2018-5-22 16:14编辑过]
Option Explicit Dim AA As Class1 Private Sub Form_Load() Set AA = New Class1 MsgBox AA.AA(100) Set AA = Nothing End Sub
Option Explicit Dim AAA As Class2 Public Function AA(Count As Integer) As Integer Dim i As Integer, BB As Integer BB = 0 Set AAA = New Class2 For i = 0 To Count AA = AAA.AA(AA, i) Next i Set AAA = Nothing End Function
Option Explicit Public Function AA(i As Integer, j As Integer) As Integer AA = i + j End Function
Option Explicit Dim AA As Class1 Private Sub Form_Load() Set AA = New Class1 MsgBox AA.AA(0, 10) MsgBox AA.AA(1, 10) Set AA = Nothing End Sub
Option Explicit Dim AAA As Class2 Public Function AA(Mode As Integer, Count As Long) As Long Dim i As Integer, BB As Integer BB = 0 Set AAA = New Class2 If Mode = 0 Then For i = 1 To Count AA = AA + i Next i ElseIf Mode = 1 Then AA = AAA.AA(Count) End If Set AAA = Nothing End Function
Option Explicit Public Function AA(i As Long) As Long Dim ii As Integer AA = 1 For ii = 1 To i AA = AA * ii Next ii End Function