title: Why can't I inherit from int in C++?
body: <p>I'd love to be able to do this:</p>
  
  <pre><code>class myInt : public int
  {
  
  };
  </code></pre>
  
  <p>Why can't I?</p>
  
  <p>Why would I want to? Stronger typing. For example, I could define two classes <code>intA</code> and <code>intB</code>, which let me do <code>intA + intA</code> or <code>intB + intB</code>, but not <code>intA + intB</code>.</p>
  
  <p>"Ints aren't classes." So what?</p>
  
  <p>"Ints don't have any member data." Yes they do, they have 32 bits, or whatever.</p>
  
  <p>"Ints don't have any member functions." Well, they have a whole bunch of operators like <code>+</code> and <code>-</code>.</p>