javascript inheritance using the prototype property
by THavamani[ Edit ] 2013-08-05 17:41:01
how to inherit the property of one class into another class in javascript
For example
function car() {}
car.prototype.bar = function(){ return 'car';}
function bus() {}
bus.prototype = new car() ; // now it will work
bus.prototype.bar = function(){ return 'bus'; }
var b = new bus ;
console.log(b.bar());
In the above example properties of class 'car' is accessed by object of class 'bus'