in reply to Method Chaining and Accessors
This is a bit off-topic, but the first thing that popped into my head at the term "method chaining" was the common Smalltalk idiom for what you are trying to do:
I always thought it was very elegant and concise. method1 and method2 can return whatever they want. The yourself then hands back the newly created object.| myObj | myObj := SomeClass new method1: foo; method2: bar; yourself.
Of course in Smalltalk, you would have to write separate getter and setter methods (though you could overload the method name).
|
|---|