General information
Category:
Object Oriented Programming
Title:
How do I access data of returned objects?
Assume the following:
define class Item as Custom
vValue = .NULL.
enddefine
define class List as Custom
oPrev = .NULL.
oNext = .NULL.
oData = .NULL.
enddefine
define class Collection as Custom
oList = .NULL.
function init
this.oList = createobject("List")
this.oList.oData = createobject("Item")
endfunc
function getitem as Object
return this.oList.oData
endfunc
enddefine
Why will this work:
oColl = creteobject("Collection")
oItem = oColl.GetItem()
oItem.vValue = "Test"
? oItem.vValue
But this will not:
oColl = createobject("Collection")
oItem = oColl.GetItem()
oItem.vValue = "Test"
? oColl.GetItem().vValue && This line is the one that I'm questioning
Whenever I try that line (? oCol.GetItem().vValue) I get a message, "Invalid subscript reference". If I'm returning an object with a vValue property in GetItem() (which I am as seen in the first example), then why can't I simply reference that objects property as in the second example? Microsoft has a way of allowing this in their Outlook Object because I can do the following:
oApp = createobject("Outlook.Application")
oName = oApp.getnamespace("MAPI")
oFolder = oName.getdefaultfolder(13) && Tasks Folder
? oFolder.getfirst().subject
Grateful for any help possible!
Rodd
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only