就是将一个对象作为另一个对象的属性。 'CLocation Option ExplicitPublic Property Get href() As String ... End Property Public Property Let href(ByVal RHS As String) ... End Property 'CWindow Option ExplicitPublic Property Get location() As CLocation ... End Property
对象里面封装一个对象的属性接口'假如对象名叫mainobjprivate obj as object '假如obj有个方法叫abcpublic property get subobj() as object set subobj = obj end property那么在外围就可以这样调用 dim x as new mainobj call x.subobj.abc()
'CLocation
Option ExplicitPublic Property Get href() As String
...
End Property
Public Property Let href(ByVal RHS As String)
...
End Property
'CWindow
Option ExplicitPublic Property Get location() As CLocation
...
End Property
'假如obj有个方法叫abcpublic property get subobj() as object
set subobj = obj
end property那么在外围就可以这样调用
dim x as new mainobj
call x.subobj.abc()