Answered Chained Methods. Example Required.

Cecil

19+ years progress programming and still learning.
Hi

Can anyone give me an example of how methods can be chained together using the OOABL.
I've asked this question before but I did not get any resolution.

OE 11.3.1
 

jmls

New Member
you have to make a method return an instance of the class itself. Because this is an object that is returned, you can then invoke another method on the returned object

so:

class foo:
def property bar as char no-undo get . set .

method public foo MethodA():
/** do stuff */
return this-object.
end method.

method public foo MethodB():
/** do stuff */
return this-object.
end method.
end class.

/** procedure a */
def var a as foo no-undo.

a = new foo().

message a:MethodA():MethodB():bar view-as alert-box.

/** procedure b */

message (new foo()):MethodA()
:MethodB()
bar
view-as alert-box.
 

Cecil

19+ years progress programming and still learning.
Hey Sorry for the late reply. This would now be the third time I posted on this thread. Thanks for the example, I now have a better grasp on what I was trying to achieve.
 
Top