title: How to check if member method is called
body: <p>I have a class(Let's say: <strong><em>Parent</em></strong>) that <strong>creates</strong> inside <strong><em>Member</em></strong> object.</p>
  
  <p>I wonder, how I can test that <strong>member</strong> method is called on <strong>parent</strong> method call.</p>
  
  <p>Let's see an example:</p>
  
  <pre><code>class Parent : public IParent
  {
  public:
      Member() : member{} {}
      void parent_method() override
      {
          member.member_method();
      }
  private:
      Member member;
  }
  </code></pre>
  
  <p>I would like to prepare test that would check if <strong><em>member_method</em></strong> is called on <strong><em>parent_method</em></strong> call using <strong>GTest / GMock.</strong></p>
  
  <p><strong>Important</strong>: I would like to avoid polymorphic calls or any dynamic allocations - if it possible.</p>
  
  <p>I had idea to pass some Factory in constructor and build proper Member object (real or mock) but it needs polymorphic calls and dynamic allocations.
  I want to avoid this overhead. </p>
  
  <p>Is there any method to do it in quite clean way?</p>
  
  <p>Any suggestions are welcome. Thanks in advance.</p>