Re: [VB6 ] 想請問關於TYPE的問題,不能循環依存?
※ 引述《otima ()》之銘言:
: Type typeWave
: Data as Integer
: Child() as typeWave
: End Type
用物件類別模組可以達到你的需求
很久沒用VB6了,
剛剛拿回來用用看,
覺得很不習慣呀!
以下一個小範例,
如果需要多個child,
用VB的陣列或collection都可以實做...
'---------表單程式碼---------'
Private Sub Form_Paint()
Set a = New Node
Print a.createChild.createChild.createChild.createChild.Index
End Sub
'---------物件類別模組---------'
Option Explicit
Private id As Integer
Public Function createChild() As Node
Set createChild = New Node
createChild.Index = id + 1
End Function
Public Property Get Index() As Integer
Index = id
End Property
Property Let Index(value As Integer)
id = value
End Property
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.133.134.222
討論串 (同標題文章)