Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I access data of returned objects?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
How do I access data of returned objects?
Divers
Thread ID:
00684491
Message ID:
00684491
Vues:
48
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
Fil
Voir

Click here to load this message in the networking platform