Information générale
Catégorie:
Programmation Orientée Object
Titre:
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement