Goodnight. Faced a problem. There is approximately the following construction:
/** * Создаем объект класса, пихаем в его прототип свойства */ var ParentClass = new Function; var pContainer = ParentClass.prototype; pContainer[<prop_name>] = <prop_value> /** * Создаем дитё, задача - пихнуть в прототип cContainer-а свойства класса- родителя, но так, чтобы при изменении свойства прототипа родителя в ребенке - в прототипе родителя значения не менялись */ var ChildClass = new Function; var cContainer = ChildClass.prototype; // ДОлжно было прокатить .... не прокатило :( Extends(cContainer, ParentClass); function Extends( child, parent ) { var cProto = child.__proto__; var pProto = parent.prototype; var Ext = new Function; Ext.prototype = pProto; Ext.constructor(); cProto = Ext.prototype; }
Please help with Extends feature: D
PS Please do not laugh with the Extends function. As I just did not try: and eval th, and than just not tried. The main thing is that the ChildClass object is an instance from the rotor.
Thank you in advance