title: Which design pattern should I use in this case?
body: <p>I have a class named <code>DS</code> which can (1) read a data from file and accordingly build a data structure from scratch, or (2) read a pre-built data structure from file. I originally wrote:</p>
  
  <pre><code>class DS 
  {
      DS(std::string file_name, bool type);
  }
  </code></pre>
  
  <p>where <code>file_name</code> is the file to read and <code>type</code> specifies what we are reading, data or pre-built data structure. This method is not very elegant, as far as I am concerned. I also tried the following:</p>
  
  <pre><code>class DS 
  {
      DS(std::string file_name);
      void CreateFromData();
      void ReadExisting();
  }
  </code></pre>
  
  <p>But because modification is not allowed once built, I do not want the user to first call <code>CreateFromData</code> and then <code>ReadExisting</code>.</p>
  
  <p>Are there some design patterns to address this issue?</p>