title: how will Contained class call member function of containing class - Composition in C++
body: <p>This is a general design question from C++ perspective. I have a container class which contains objects of 2 other classes.</p>
  
  <p>From container class we can call methods of the contained class object "as we have handle to the contained class object" e.g. objContainedClass1->SomeMthod();</p>
  
  <p>But I want to know how would the contained class object (objContainedClass1) access methods of container class.</p>
  
  <p>I can think of following ways:</p>
  
  <ol>
  <li><p>The container class object passes the pointer to itself (this pointer) to the contained class constructor. Using this pointer, the contained class can access the methods of container class.</p></li>
  <li><p>Make some functions in the container class as static.</p></li>
  </ol>
  
  <p>Any more ideas of achieving this?</p>
  
  <p>Thanks</p>