title: Initialize child class with base class object C++?
body: <p>So, the title may be a little confusing, but here is my question:</p>
  
  <p>I have a superclass (let's call it <em>SupClass</em>) and a subclass that inherits from SupClass (let's call it <em>InhClass</em>). Now, I want to make a constructor for my InhClass that receives a SupClass object and initializes the "SupClass part" of InhClass with it.</p>
  
  <p>Here is a code example trying to make it clear:</p>
  
  <pre><code>Class SupClass { 
  public:   
         SupClass() {
             //Initialize SupClass object
         }
  };
  
  Class InhClass : private SupClass {
  public:
         InhClass(SupClass obj) {
              //Initialize SupClass inheritance with obj
         }
  };
  </code></pre>
  
  <p>This would be to use in a case where you already have a SupClass object initialized (and possibly worked on) but for a short period, or from then on you want to use a InhClass object. Instead of copying everything (or closing and reopening a file, for example), I would be able to just initialize my child class with its base class object.</p>
  
  <p>Thanks in advance,</p>
  
  <p>I'm sorry about any english mistakes,</p>