Fields are as static fields in Qooxdoo library

丶灬走出姿态 提交于 2019-12-05 22:01:08

This is not a issue from qooxdoo. You should not initialize reference types on the class description. You should initialize reference types with the constructor.

There is a good article in the qooxdoo manual which explains the problem.

Here is your improved example:

    qx.Class.define("com.BaseClass",
    {
        extend : qx.core.Object,

        construct: function() {
          this._children = [];
        },

        members:
        {
            _children: null,

            getChildrenCount: function(){
                return this._children.length;
            },

            addChild: function(child){
                this._children.push(child);
            }
        }
    });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!