title: Globals once again
body: <p>I know that nearly everything has been said on 'globals' topic. Apologies for coming back to it here. There is something in the production code, I don't fully understand. Would very much appreciate help on that. so thanks in advance.</p>
  
  <p>Consider following implementation:</p>
  
  <p>file1.h</p>
  
  <pre><code>class classA
  {
      classA();
      // something in 
  };
  
  const classA&amp; GetClassA();
  </code></pre>
  
  <p>file1.cpp</p>
  
  <pre><code>classA::ClassA()
  {
  
      cout &lt;&lt; "I have been called";
  
      // do initialization
  }
  
  
  const classA obA;
  
  const classA&amp; GetClassA() { return obA; }
  </code></pre>
  
  <p>The GetClassA function is called all around. The same global object (I thought) is visible across translation units (at least that's my expectation). However (mysteriously to me) it looks like the classA c-tor is called more than once. Could anyone elaborate on it, pls?</p>