var A = function() {
    this.location = "world";
};
var B = function(){
   this.sayHello = function() {
        console.log("hello " + this.location)
    }
}
var C = function() {
    this.showUpAndLeave = function() {
        this.sayHello();
        console.log("goodbye " + this.location); 
    }
};

B.prototype = new C();
A.prototype = new B();

var me = new A();
me.showUpAndLeave();