title: Global Inline Functions
body: <p>I have here a singleton class, called <code>Master</code>. This class has some other entities that do a specific job. The <code>Master</code> class has a <code>get</code> method for these entities.</p>
  
  <pre><code>namespace Framework {
      class Master {
      private:
          NetworkController * mNetworkController;
          FileController * mFileController;
  
          static Master * gInstance;
  
      public:
          static Master * getInstance();
  
          NetworkController * getNetworkController();
          FileController * getFileController();
      }
  }
  </code></pre>
  
  <p>I use these entities allthoughout the program like so:</p>
  
  <pre><code>Framework::Master::getInstance() -&gt; getNetworkController()
  Framework::Master::getInstance() -&gt; getFileController()
  </code></pre>
  
  <p>As you can see, it's a bit long and time-consuming to type in. So I tried putting them in a macro, like so:</p>
  
  <pre><code>#define NETWORK_CONTROLLER() Framework::Master::getInstance() -&gt; getNetworkController()
  #define FILE_CONTROLLER() Framework::Master::getInstance() -&gt; getFileController()
  
  namespace Framework {
      class Master {
          ...
      }
  }
  </code></pre>
  
  <p>However, I find this method messy and confusing. So I tried <code>inline</code> methods and added them in one header file.</p>
  
  <pre><code>#ifndef __FrameworkHelper__
  #define __FrameworkHelper__
  
  inline Framework::NetworkController * MasterNetworkController() { return Framework::Master::getInstance() -&gt; getNetworkController(); }
  inline Framework::FileController * MasterFileController() { return Framework::Master::getInstance() -&gt; getFileController(); }
  
  #endif
  </code></pre>
  
  <p>But it gave me compile errors when trying to use them on a different class saying:</p>
  
  <pre><code>error C2653: 'Framework' : is not a class or namespace name
  </code></pre>
  
  <p>I don't know why it would throw an error like this. How can I make these inline methods available allthroughout my program?</p>