title: How to exchange data between classes?
body: <p>I'm learning C++ and moving my project from C to C++. In the process, I stumbled on this problem: how to save/update variables that are in use in several classes? In C I used global variables, but it is not good for C++.</p>
  
  <p>So, let's assume we have 4 classes:</p>
  
  <pre><code>class Main_Window
  {
      //...
      void load_data_menu_selected();
  }
  
  class Data
  {
      //...
      double *data;
  }
  
  class Load_Data
  {
      //...
      double *get_filename_and_load();
  }
  
  class Calculate
  {
      //...
      int do_calculation()
  }
  </code></pre>
  
  <p>So, Main_Window is class for application's main window where it interacts with user input etc.<br>
  I want to do:
  <li>create an instance of class Data in the Main_Window</li>
  <li>use Load_Data for loading data from file and store it in the Data</li>
  <li>use Calculation class for doing something with read data in Data class</li></p>
  
  <p>The question is: where I should create classes, to make Data class members available from other classes.  Should I use Inheritance?</p>