c++ call a method from one class of other class
<p>I have two classes </p>

<pre><code>Class A
{
   char * param1;
   char * param2;
   void SetParam1(const char * ptr)
   {
        param1 = new char[strlen(ptr) + 1];
        strcpy(param1,ptr);

   }

   void SetParam2(const char * ptr)
   {
        param2 = new char[strlen(ptr) + 1];
        strcpy(param2,ptr);

   }
   void DoWork()
   {
      B obj;
      //use this object to do some work
   }
};
</code></pre>

<p>Now there is a class B which is</p>

<pre><code>    Class B
    { 
       char * param3;
       char * param4;
       void Exec();
   };
</code></pre>

<p>How can i use <code>param1</code> and <code>param2</code> in class B's <code>Exec</code> method without having to make them a member of class B and allocate memory as was done for "class A".</p>
