in reply to Class or Object composition ??
For instance, if you were implementing a calculator, your object would have methods such as add(...), subtract(...), divide(...). Each of these methods would call a decorator class you fed in at some point. What if you wanted to work w/ them as BigInteger, or IEEE Floating point, or some other method for floating point?
The only difference from what I'm stating and your second example, is you wouldn't "use SendRcv;" w/i there. You'd do something like...
Or in two lines..$server = Server->new( SendRcv->new() )
</code>$server = Server->new(); $server->set_comm_i_cant_think_of_better_name( SendRcv->new() )
|
|---|