javascript 面向对象是实现类的多重继承。具体代码如下:
function multipleinheritPrototype() {
if (arguments.length == 0) {
return;
}
var args = arguments;
var sub = args[0];
var constructor = sub.prototype.constructor;
if (!Object.create) {
Object.prototype.create = function (obj) {
function f() {
}
f.prototype = obj;
return new f();
};
}
var base;
for (var i = 1; i < args.length; i++) {
base = Object.create(args[i].prototype);
for (var attr in base) {
sub.prototype[attr] = base[attr];
}
}
sub.prototype.constructor = constructor;
}
更多信息请查看IT技术专栏