Hello:
I was reading through Chapter 8 (3rd edition) and noticed a short comment that struck me as 'strange' (but not necessarily 'impossible').
Here the text segment that I think may not be correct (very last paragraph on p.215):
"The Set syntax inside of the Property Set and Let is optional. Because you write directly to the Variant private property variable, you can use either. ..."
To test this statement I entered the code shown on pages 215 (and again on 216). Below I pasted the code (if anyone wants to try it out). I ran said code with and without the
Set inside of the
Property segments (alternatively commented-out). I can't get this to run WITHOUT the
Set statement and therefore I was wondering if anyone on here could shed some light on this situation (perhaps referencing the proper MSDN source at the same time)?
Most appreciated,
AR.
Inline Attachment:
Code:
Dim objFileHelper
Dim objFSO
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set objFileHelper = New FileHelper
'with 'Set' (works only with 'Set' in class below):
Set objFileHelper.FSO = objFSO
'without 'Set' (again, works only with 'Set' in class below):
'objFileHelper.FSO = objFSO
Class FileHelper
'write-only class
Private m_objFSO
Public Property Set FSO(objFSO)
'Set m_objFSO = objFSO
m_objFSO = objFSO
End property
Public Property Let FSO(objFSO)
'Set m_objFSO = objFSO
m_objFSO = objFSO
End Property
End Class