Javascript 在父类中设置构造函数的节点js中的多重继承

Javascript 在父类中设置构造函数的节点js中的多重继承,javascript,node.js,inheritance,Javascript,Node.js,Inheritance,如何在父类中设置构造函数并调用从父类继承的类中的对象 父类: var request = resuire('request'); var a = function(options) { if(!(this instanceof a)) { return new a(options); } var self = this; self.id = math.random(); self.baseUrl = 'http://example.com/'; se

如何在父类中设置构造函数并调用从父类继承的类中的对象

父类:

var request = resuire('request');
var a = function(options) {
   if(!(this instanceof a)) {
     return new a(options);
   }
   var self = this;
   self.id = math.random();
   self.baseUrl = 'http://example.com/';
   self.options = options || {uri: self._baseUrl};
}

a.prototype._request = function reqest(options, callback){
   var self = this;
   request(options, function(err, res, body){
      self._determineResponse(err, res, body, function(){
         return body;
      }, callback);
   }
}
儿童班:

var util = require('util');
var a    = require('a');
var b = function(){
    var self = this;  
}

b.prototype.auth(username, password, callback) {
   // access parent method (private or public) here to perform request
   a._request .... something
}

util.inherits(b, a);
查询:

如何设置父构造函数 访问父方法的最佳方法 将inherits调用放在prototype'的第一个附件之前,否则将覆盖它。