Simple Container without Inheritance
DIGG IT!
1
Comments
Published
Wednesday, June 04, 2003
at
9:29 AM
.
Every once in a while I want a container with no inheritance and with no properties hidden or otherwise. This does the trick.
Container = function(){
this.__proto__ = undefined
delete this.constructor
delete this.__constructor__
}
t = new Container()
It seems that you can modify the inheritance chain by setting this.__proto__ within the constructor. In this case it is set to undefined to provide a block of memory to store information without inheritance.

how can i access protected variables in the base class? tnx