Class CompExProp
Private mComponent
Private mShapeSize
Private Sub Class_Initialize()
mShapeSize=0
End Sub
'---------------begin set--------
Public Property Let Component(ByVal objVar)
mComponent=objVar
End Property
Public Property Let ShapeSize(ByVal objVar)
mShapeSize=objVar
End Property
'--------end set---------
'-----------begin get----------
Public Property Get Component()
Set Component=mComponent
End Property
Public Property Get ShapeSize()
Set ShapeSize=mShapeSize
End Property
'--------end get-------
Public Function clone(byval pCompExProp)
Set Component=pCompExProp.Component
Set ShapeSize=pCompExProp.ShapeSize
End Function
End Class
For i=1 To coll.count
Dim objCompExProp
Set objCompExProp=New CompExProp
Set objCompExProp.Component=coll.item(i) 'error, object doesn't support this property or method:objCompExProp.Component. remove the "set" resolved it
Set objCompExProp.ShapeSize=getShapeSize(coll.item(i))
Call DictAdd(dict,"abc"&(i),objCompExProp)
'Call output(" add into dict: abc"&(i)&" area: "&calcArea(coll.item(i)))
Next
vbs对象成员的使用
最新推荐文章于 2024-06-27 18:25:23 发布