I am using prototypal inheritance in JavaScript and have hit an issue I can't quite figure out. Many JS inheritance examples show accessing a super's members from a sub, but I need to access the sub's members from the super.
I'm building a tool to performance test mapping web services. I want to support multiple versions of the WMS protocol. I want to keep all shared functionality / properties in a WMS base class wherever possible, and only provide specific version implementation details where necessary. My WMS v1.1.1 function looks like this:
function wms111() {
this.version = '1.1.1';
}
wms111.prototype = new wms();
My wms function (short version) is as follows:
function wms() {
var that = this;
this.HTTPMethod = 'GET';
this.descriptionParameters = {
service: 'wms',
version: that.version,
request: 'getcapabilities'
};
}
I then test this with a call like
var service = new wms111();
var descriptionParameters = service.descriptionParameters;
I get the descriptionParameters object with the service and request properties correctly defined, but version is undefined.
Can anyone help me figure out how I access the correct properties from wms111?
Any help much appreciated.