News for hackers. Stuff that matters.
Re:The world's smallest and fastest classical JavaScript inh... by alfl23 on Saturday February 15, 2014 @03:34PM (#7245201)
JavaScript inheritance library? JS does this by default, no need for more useless boilerplate. The below works in all browsers, IE5 included.

function inherits(child, parent) { function tmp() {}; tmp.prototype = parent.prototype; child.prototype = new tmp(); child.prototype.constructor = child; }

function A() { this.x_ = 5 }; function B() {A.call(this);};inherits(B, A);

There are no comments on this comment yet.