iegorov
10/29/2013 - 4:20 AM

classical inheritance 1

classical inheritance 1

function Parent(name) {
  this.name = name || 'Adam';
}

Parent.prototype.say = function() {
  return this.name;
};

function Child() {}

function inherit(C, P) {
  C.prototype = new P();
}

inherit( Child, Parent );