title: How do you expose a C++ class in the V8 Javascript Engine so it can be created using new?
body: <p>The <a href="http://code.google.com/apis/v8/embed.html" rel="noreferrer">official examples</a> of exposing a Point class seem to assume that there will be a fixed number of instances of it in your program. It is not clear how new instances are allocated in the C++ code, when <em>new</em> is called in Javascript.</p>
  
  <p>How would you expose a class that can have multiple instances? For example, an Image class:</p>
  
  <pre><code>var img1 = new Image( 640, 480 );
  var img2 = new Image( 1024, 768 );
  
  img1.clear( "red" );
  img2.clear( "black" );
  </code></pre>