General information
Category:
Object Oriented Programming
Title:
How to build upon objects returned from methods?
When dealing with Microsoft's Outlook application, I can do the following:
oApp = createobject("Outlook.Application")
oName = oApp.GetNameSpace("MAPI")
oFolder = oName.GetDefaultFolder(3) && Task Items
* This line is the one I'm interested in
oFolder.Items(1).subject = "This is a test"
Items() is a method of the Folder object. It returns an Item object and I can continue to reference the properties and methods of that object just by tacking on the .subject, etc.
I've built a very similar class structure ... one in which an "collection" object has an items() method that returns the object that it stores; but I'm not able to access the properties and methods of the returned object in the above manner. Instead, I'm forced to do this:
oItem = oFolder.Items(1)
oItem.subject = "This is a test"
What can I do to my classes to enable the kind of "inline" syntax that I am able to use with the Outlook object?
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