Is there a better way to design this message passing code?
<p>class A was using below two functions to build and send messages 1 &amp; 2</p>

<pre><code>builder::prepareAndDeliverMsg1(msg1_arg1,msg1_arg2)
{
}

builder::prepareAndDeliverMsg2(msg2_arg1,msg2_arg2)
{
}
</code></pre>

<p>Now, a new class B is introduced, which would like to do what A was doing  in two stages</p>

<p>stage1->prepare
stage2->deliver</p>

<p>I was thinking to extend the builder class like below:</p>

<pre><code>///----

builder::prepareMsg1(msg1_arg1,msg1_arg2)
{
}

builder::prepareMsg2(msg2_arg1,msg2_arg2)
{
}

builder::deliverMsg1(msg1_arg1)
{
    This function, inserts re-calculated msg1_arg1 into the prepared message in stage1
}

builder::deliverMsg2(msg2_arg1)
{
   This function, inserts re-calculated msg2_arg1 into the prepared message in stage1
}

// These two functions are still retained for the usage of class A
builder::prepareAndDeliverMsg1(msg1_arg1,msg1_arg2)
{
}

builder::prepareAndDeliverMsg2(msg2_arg1,msg2_arg2)
{
}

//---
</code></pre>

<p>I would like to know, if there is any better way of designing this ?</p>
