The instance
you return is a new Object
containing a few methods known to it. The local methods are not within the scope of instance
. You should call the instance methods, so:
function _myGetFullName() {
return this.getFirstName() + ' ' + this.getLastName();
}
or call the function within the context of the current instance
function _myGetFullName() {
return _myGetFirstName.call(instance) + ' ' +
_myGetLastName.call(instance);
}
or, ofcourse
function _myGetFullName() {
return this.firstName + ' ' + this.lastName;
}
Anyway, you code is a bit odd. You can only derive one instance of Customer. Didn't you mean something like this?