G
Guest
This is a semi-advanced question about ASP VBScript 5.0 classes. If you're
knowledegable, please lend a hand!
VBScript class instances can have properties that have objects assigned to
them. Borrowing R.Quinn's example from ASP101:
Public Property Get Authors()
if not isobject(m_Authors) then
set Library = New cLibrary
Call Library.GetAuthorsByBookID(Me.ID)
set m_Authors = Library.Authors
Set Library = nothing
end if
Set Authors = m_Authors
End Property
In this example, a collection of authors is assigned to property Authors by
calling an method of another class and using the "Set" keyword. This sort of
"external" loading of an object is characteristic of using the Set command.
I want to know if it is possible to assign a complex object to a property
without calling to an external class. For example, it would be elegant if I
could call a private GetAuthors method of the same class somehow (versus
using cLibrary), and pass the resulting object back to the Property.
Is this possible? Can someone get me started with the syntax of this?
Thanks.
-KF
knowledegable, please lend a hand!
VBScript class instances can have properties that have objects assigned to
them. Borrowing R.Quinn's example from ASP101:
Public Property Get Authors()
if not isobject(m_Authors) then
set Library = New cLibrary
Call Library.GetAuthorsByBookID(Me.ID)
set m_Authors = Library.Authors
Set Library = nothing
end if
Set Authors = m_Authors
End Property
In this example, a collection of authors is assigned to property Authors by
calling an method of another class and using the "Set" keyword. This sort of
"external" loading of an object is characteristic of using the Set command.
I want to know if it is possible to assign a complex object to a property
without calling to an external class. For example, it would be elegant if I
could call a private GetAuthors method of the same class somehow (versus
using cLibrary), and pass the resulting object back to the Property.
Is this possible? Can someone get me started with the syntax of this?
Thanks.
-KF