title: Copy Constructors and Polymorphism
body: <p>I have a class, which has subclasses for which I would like to handle copying objects properly. The superclass, called Item, has a copy constructor and the subclasses also have their own. However, what I want to know is to how to make it the following will work.</p>
  
  <p><code>Item</code> class (simplified description)</p>
  
  <p>constructor:</p>
  
  <pre><code>public Item(...) {
  }
  </code></pre>
  
  <p>copy constructor:</p>
  
  <pre><code>public Item( Item template ) {
  }
  </code></pre>
  
  <ul>
  <li>The basic layout the same for each subclass in this regard, excepting that at the moment they just make a new instance of item using a different constructor intended for making a new object from data stored in a text file (passing it data from the template object) and then fill in the additional fields from the template object.</li>
  </ul>
  
  <p>The subclasses are things like Weapon, Armor, Shield, etc.</p>
  
  <p>What I want to do is to able to say:</p>
  
  <pre><code>Weapon weapon = new Item( weapon );
  </code></pre>
  
  <p>Where weapon is a <code>Weapon</code> and the proper copy constructor (belonging to the specific subclass) is called, returning a new Object of type <code>Weapon</code>, as opposed to just getting back a new <code>Item</code> with only the <code>Item</code> parts that belonged to weapon. What is the best and/or right way to do this?</p>