If B inherits from A, the priv object created during B construction is only valid for B. Any references to this[priv] in A will cause undefined exception, since priv string is different in A from B.
Steps to reproduce:
var C=Class(function(publ,priv){
print(priv)
publ.__init__=function(){
print(priv)
print(this[priv]);
}
});
var D=Class(C,function(publ,priv, b){
print(priv)
})
new D()
JSOLaitLive code to reproduce
Possible solution would be to require developer to create private object manually in __init__:
this[priv]={};
or to supply some function that would do that:
createPriv(this);
This way priv object will be created only when needed.
Another solution would be to pass priv string from parent to the child class scope function. This would probably create conflicts with multiple inheritance.