/*


































































































*/
// Create a function, that receive an Function Constructor and a Object and returns a instance of the Function Constructor
// where it prototype is exposed with the property `parent` and should be the Object in the seccond param, all the other
// params should be used in the Function Constructor.

function extend(FunctionConstructor, objectInstance) {
  // This is unfinished, as example to start thinking on how to do it. The prototype and arguments are missing here...
  FunctionConstructor.prototype = objectInstance;
  var instance = new FunctionConstructor();
  instance.parent = objectInstance;
  var args = Array.prototype.slice.call(arguments, 2);
  return FunctionConstructor.apply(instance, args);;
}

function A(name){
  this.name = name;
  
  // Create also a method that override `hello` and uses the method from C acessing by the reference contained in the parent
  // property, that will be added by the extend function
  this.hello = function(){ return this.parent.hello.apply(this, arguments) + ', welcome!'; };
  return this;
};
function B(greeting){
  this.getGreeting = function(){ return greeting; };
  return this;
}
function C(){
  this.getGreeting = function(){ return ''; };
  this.hello = function(){ 
    return this.getGreeting() + this.name; 
  };
  return this;
}

// When create a instance of A, it needs to have B and C as it own prototype, and have a fixed value 'hello' for the greeting
// defined by your extend function, example:
var c = new C();
var b = extend(B, c, 'hello ');
var a = extend(A, b, 'Person Name');
a.hello(); // hello Person Name, welcome!
var a1 = extend(A, b, 'Another Person');
a1.hello(); // hello Another Person, welcome!