title: Javascript Parasitic Inheritance
body: <p>I'm struggling with Javascript <strong>classical Inheritance</strong> <a href="http://www.crockford.com/javascript/inheritance.html"><sup>1</sup></a>. While, in the end <strong>Douglas Crockford</strong>, rejects its first attemps to support classical model in Javascript, I find it interesting to understand:</p>
  
  <blockquote>
    <p>I have been writing JavaScript for 8 years now, and I have never once found need to use an uber function. The super idea is fairly important in the classical pattern, but it appears to be unnecessary in the prototypal and functional patterns. I now see my early attempts to support the classical model in JavaScript as a mistake.</p>
  </blockquote>
  
  <p>However, there is something not really clear for what concerns <strong>Parasitic Inheritance</strong>:</p>
  
  <pre><code>function ZParenizor2(value) {
     var that = new Parenizor(value);
     that.toString = function () {
        if (this.getValue()) {
           return this.uber('toString');
        }
        return "-0-"
     };
     return that;
   }
  </code></pre>
  
  <p>ZParenizor, as far I've understood is defined in terms of Parenizor. But Parenizor is the base class and it inherits from nobody. So <code>this.uber</code> function will not be defined and in fact I've an error when I call the <code>toString</code> method of a new ZParenizor2 object.</p>
  
  <p>Am I correct, or I'm ignoring something?</p>
  
  <p><strong>UPDATE</strong>
  I was right. This method only works when you create ZParenizor with 0 as parameter, since it does not need to call the <code>uber</code> method (as you can see form the method imeplementation).</p>
  
  <p>When you try it with a different parameter, I get this error:</p>
  
  <pre><code>Uncaught TypeError: Object #&lt;error&gt; has no method 'uber'
  </code></pre>