I am using “constructor chaining” to define a base class (Super).
function Super () {
this.member1 = 'superMember1';
this.member2 = 'superMember2';
}
function Sub() {
Super.call(this, arguments);
this.member3 = 'subMember3';
var t = this.hasOwnProperty("member1"); // gives me true, so I cannot use it
}
How can I test whether a member (1,2,3) is defined (belonging) in my Sub class or in the Super class?
Remark: `this[“name”]’ is not the way, because I can only decide whether a value has been assigned – not if it is belonging to Super or Sub.
As Darhazer comments below, constructor chaining copies the members, so it might be tricky.
Obviously as of the answers so far, not possible. Hence will be closed.