以前是这样的:
Class C1
Public dom As New Document
End Class
但是这样一旦C1被实例化,那么dom会一直占着内存,但我用到dom的地方并不多,改成如下会有改善吗?Class C1
Function dom() As Document
Set dom = New Document
End Function
End Class
上面2种都可以通过dom.xxx来调用Document的方法,2种方法占用的内存一样吗?
Class C1
Public dom As New Document
End Class
但是这样一旦C1被实例化,那么dom会一直占着内存,但我用到dom的地方并不多,改成如下会有改善吗?Class C1
Function dom() As Document
Set dom = New Document
End Function
End Class
上面2种都可以通过dom.xxx来调用Document的方法,2种方法占用的内存一样吗?
private m_dom as document
public property get dom() as document
if m_dom is nothing then set dom = new document
set dom = m_dom
end property