calling function to store the result in "this"
<p>My SortedMerge function is declared as under :</p>

<pre><code>sortedMerge(ListOfParts *&amp; l2, ListOfParts *&amp; result);
</code></pre>

<p>In the below function of the same class, I wish to call this SortedMerge() function using object <code>tmp1</code> and get the result in the object that called the mergeSort functionbelow; ie, <code>this</code>.
Basically, object l1 in main() calls mergeSort() and from there I get 2 Lists tmp1, tmp2 and now I wish to call SortedMErge to store the RESULT in l1;</p>

<p>Really stuck.  I thought using "this" would suffice, but I think it has some conflict with the function parameter not taking ant CONST and "this" would make it CONST.</p>

<p>So what could be another work around for this?</p>

<pre><code>Class ListOfParts{

struct CarPart{

int data;
CarPart *next;

}


CarPart *Head;

public:


    sortedMerge(ListOfParts *&amp; l2, ListOfParts *&amp; result);

void mergeSort(){

    ListOfParts *tmp1;
    ListOfParts *tmp2;
    if(this-&gt;Head == NULL || this-&gt;Head-&gt;Next == NULL){

        return;

    }

    this-&gt;frontBackSplit(tmp1, tmp2);

    tmp1-&gt;mergeSort();
    tmp2-&gt;mergeSort();


    tmp1-&gt;sortedMerge(tmp2, this)   
}

}
</code></pre>
