title: Constructors infinite cycle in cpp
body: <p>I have a <code>Logger</code> <em>singleton class</em> that its purpose is to print messages to log file / screen.
  This Logger has some configurations that he wants to read from configuration file. Here is the constructor of Logger:</p>
  
  <pre><code>Logger::Logger(const std::string&amp; confFilePath) {
      m_logConf = new LogConfig(confFilePath);
      ...
  }
  </code></pre>
  
  <p>Class <code>LogConfig</code> uses Configuration Object that knows how to parse a configuration file. Here is the class <code>Ctor</code>:</p>
  
  <pre><code>LogConfig::LogConfig(const std::string&amp; confFilePath) {
      m_config = new Configuration(confFilePath);
      ...
      m_config-&gt;ParseConfFile();
  }
  </code></pre>
  
  <p>The problem is that in <code>ParseConfFile</code> method - Configuration object may want to write to the log and use Logger singleton class. But, when it tries to do it - he will enter again to Logger constructor, and then to LogConfig Ctor and there is an infinite cycle.</p>
  
  <p>I don't want to forbid Configuration class to write to the log (<code>LogConfig</code> is not the only class that uses it).</p>
  
  <p>How can I solve this cycle problem?</p>