title: Pointers and circular dependencies
body: <p>I am trying to get into C++ and I encountered few issues. My two classes look like that:</p>
  
  <pre><code>#include "Account.h"
  
  class Program
  {
  public:
      Program(void);
      ~Program(void);
      void SetAccount(Account account);
  };
  
  #include "Program.h"
  
  class Account
  {
  public:
      Program *program;
      Account(void);
      ~Account(void);
  };
  </code></pre>
  
  <p>By passing an instance of the Account class to SetAccount function am I making a copy of it or I am passing it as a reference? As I understand I am making a copy of it, but I wanted to be sure. To pass it as a reference I need to use pointers, right?</p>
  
  <p>Another issue I encountered is with my Account class. Lets say it needs to have Program class reference at some point. The problem is that both Program and Account classes have lines "#include" to each other so it causes circular dependency. Any ideas how to solve it?</p>
  
  <p><strong>Edited</strong></p>
  
  <p>My classes now looks like that:</p>
  
  <pre><code>#include "Account.h"
  
  class Program
  {
  public:
      Program();
      ~Program();
      void SetAccount(Account account);
  };
  
  class Program;
  
  class Account
  {
  public:
      Program *program;
      Account();
      ~Account();
  };
  </code></pre>
  
  <p>When I try to initialize *program in Account constructor I get "incomplete type is not allowed" and "'Program' : no appropriate default constructor available".</p>