title: How do i call one constructor into another, or call interface from each other in c++?
body: <p>i have a little completed design with c++. I have an interface that will be used for tcp communication. An inherited class from ITCP_message is TCP_Message sends data to IManipulate interface. IManipulate is inhereted Manipulator to manimulate the received messages and send acknowledge. Code  is shown here:</p>
  
  <p>ITCP_message.h</p>
  
  <pre><code> class ITCP_message{
      public:
          ITCP_message() ;
          virtual ~ITCP_message() =0;
          virtual void sendAck()  =0;
          virtual void getmessage() =0;
      };
  </code></pre>
  
  <p>I inherit this class to do actual work
  TCP_message.h</p>
  
  <pre><code>#include "ITCP_message.h"
  #include "IManipulate.h"
  class TCP_message : public ITCP_message {
  public:
      TCP_message() ;
      ~TCP_message();
      void sendAck();
      void getmessage();
  protected:
      IManipulate* itsManipulate;
  }
  </code></pre>
  
  <p>TCP_message.cpp</p>
  
  <pre><code>#include "Manipulator.h"
  TCP_message::TCP_message(){
      itsManipulate = new Manipulator;
  }
  TCP_message::sendAck(){
  ....
  }
  TCP_message::getmessage(){
  itsManipulate-&gt;manipulateData();
  }
  </code></pre>
  
  <p>I have another interface to manipulate to received message. 
  IManipulate.h</p>
  
  <pre><code>Class IManipulate{
  public:
      IManipulate() ;
      Virtual ~IManipulate() ;
      Virtual void manipulateData() ;
  } 
  </code></pre>
  
  <p>I have a inherited class from IManipulate. </p>
  
  <pre><code>Manipulator.h
      class Manipulator : public IManipulate{
      public:
          Manipulator () ;
          ~Manipulator () ;
          void manipulateData() ;
      protected:
          ITCP_message* itsMyTCPMessage;
  
  }
  </code></pre>
  
  <p>Manipulator.cpp</p>
  
  <pre><code>TCP_message.h
  Manipulator :: Manipulator (){
  itsMyTCPMessage = new TCP_message;
  }
  
  void Manipulator :: manipulateData(){
      ....
      itsMyTCPMessage-&gt;sendAck();
  }
  </code></pre>
  
  <p>I want to manipulateData() function to do actual work and send acknowledge message with interfaces. But in main function i have a problem;</p>
  
  <p>main.cpp</p>
  
  <pre><code>int main()
  {
      TCP_message tcp;
  ...
  }
  </code></pre>
  
  <p>when i create object, it first goes TCP_Message constructor and there  <em>itsManipulate = new Manipulator</em>  . then it goes to Manipulator constuctor and  there itsMyTCPMessage = new TCP_message. then it comes back to TCP_Message and it crashes. How Do I call one interface into another or how do i allocte these pointer in memory? </p>