Really simple JavaScript "Inheritance" (Example with questions)
<p><a href="http://jsfiddle.net/ajb6m/1/" rel="nofollow">I also have this running example on jsfiddle</a><br>
Sample:  </p>

<pre><code>function Animal(o) {
    o.class = Animal;
    o.name = o.name ? o.name : "Animal"; // Defaults
    o.age = o.age ? o.age : 0; // Defaults
    o.weight = o.weight ? o.weight : 0; // Defaults
    o.say = o.say ? o.say : "?";

    Animal.isOnEarth = true; // "static variable"

    return o;
}
function Cow(o) {
    o.class = Cow;        
    o.name = o.name ? o.name : "Cow"; // Defaults
    o.milk  = o.milk ? o.milk : 0; // Defaults
    o.say = o.say ? o.say : "MOOO";

    return Animal(o); //Inheritence
}
function Dog(o) {
    o.class = Dog;        
    o.isCrazyLab = o.isCrazyLab ? o.isCrazyLab : false;
    o.say = o.say ? o.say : "WOOF";

    return Animal(o) //Inheritence;
}

function Labradore(o) {
    o.class = Labradore;        
    o.isCrazyLab = o.isCrazyLab ? o.isCrazyLab : true;
    o.say = o.say ? o.say : "YARRWL";

    return Dog(o) //Inheritence;
}

var cow = Cow({});
var bessy = Cow({name:"bessy",milk:25});
var spot = Dog({name:"spot"});
var hugo = Labradore({name:"hugo"});

document.write("True or false, all these animals live on earth " + Animal.isOnEarth + " A cow says " + cow.say + "... bessy's name is " + bessy.name + " a " + spot.name + " says " + spot.say + " " + hugo.name + " says " + hugo.say);
</code></pre>

<p>I've got a small project that I'm working on and I wanted to implement a type of inheritance. I looked at some of the samples online but I don't quite understand why it would be important to go through all the rigamaroll of modifying basic behaviors in javascript. To me it feels like extending the class concepts of javascript to make it "feel" like another language may save a few lines but doesn't appear to add much core functionality. However, I am more than happy to be schooled :)</p>

<p>Some questions<br>
Is there any libraries that work in this manner?<br>
Any online examples of the pros and cons of doing this?<br>
Is there a fundamental reason NOT to do this?<br>
Any general thoughts?  </p>
