in reply to Re^5: OO Pattern Container x Elements and Method Chaining
in thread OO Pattern Container x Elements and Method Chaining

For instance see https://atomicobject.com/resources/oo-programming/other-oo-class-relationships

hence this is not uncommon

$stock->product("Book")->lastSale()->undo()

and affects both objects

update

a maybe better example I found is the part_of association of Apartment <-> Room

A $room can only belong to one containing $apartment and has a (weakened) back-reference

Like this if $room->burns() than $apartment->burns()

> but I don't believe that has any bearing on method chaining.

$street->apartment("5a")->room("living")->burns()

HTH! :)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery