title: How to copy instances of an extended CCSprite?
body: <p>I'm planning to extend the <code>CCSprite</code> class in order to create a <code>Block</code> class, which are the basic building blocks of my game. There may be a number of "archblocks" - prototypes on which individual blocks are to be based. In particular, I want to create a palette, from which the user can pick her building blocks which are to be placed on the game board. Once placed on the board, the building blocks takes on an identity of it's own.</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>class Block : public CCSprite {
  private:
    int _id = 0;
    int _type = 0;
  public:
    Block* CopyBlock();
  }
  </code></pre>
  
  <p>Once a user selects a <code>Block</code> and drops it on the game board, <code>CopyBlock</code> is going to be invoked and the prototype be safely returned to the palette, leaving the newly minted <code>Block</code> living a life of its own on the game board.</p>
  
  <p>I've noticed that <code>CCObject</code> "implements" a <code>Copy</code> method, but as far as I can tell this just refers to a <code>CopyWithZone(0)</code> for <code>CCObject</code> that isn't implemented. The <code>Copy</code> method isn't virtual, though, so I'm a little unsure if I'm able to override this. (I'm not super strong in C++ but I do have a good grasp on OOP, so I'm up for the details if anyone care to share.)</p>
  
  <p>Question:</p>
  
  <p>1) Does this design make sense? Should I go with overriding <code>Copy</code> and/or <code>CopyWithZone</code> instead?</p>
  
  <p>2) How can I implement <code>CopyBlock</code> (or <code>Copy</code> and/or <code>CopyWithZone</code>) so that both <code>CCSprite</code> stuff and members like <code>_type</code> are copied to the new <code>Block</code>?</p>
  
  <p>Thanks!</p>