Hi,

there is a difference between the source and the build version. In the build 
version the private variables (those with two underscores) are obfuscated. Use 
only private variables if no child class has to access it. Otherwise use 
protected variables (those with one underscore).

See
http://manual.qooxdoo.org/1.2.x/pages/core/classes.html#access

for more details.

Regards,
  Alex


From: aditya siram [mailto:[email protected]]
Sent: Tuesday, October 26, 2010 8:31 PM
To: qooxdoo Development
Subject: [qooxdoo-devel] Issues getting/setting variables in parent classes, 
Qooxdoo 1.2

Hi all,
There seems to be some difference with getting and setting inherited variables 
between the build and source version of my app. In the build version when a 
child class accesses a variable in the parent class it is "undefined", whereas 
in the "source" version it correctly gets the value from the super class.

For example suppose we have a parent class with one variable:
qx.Class.define("variableaccess.Parent",
{
  extend : qx.core.Object,
  members : {
    __restricted : null,
    setRestricted : function (a) {
      this.__restricted = a;
    }
  }
});

and a child class that extends it:
qx.Class.define("variableaccess.Child",
{
  extend : variableaccess.Parent,
  members : {
    getRestricted : function () {
      return this.__restricted;
    }
  }
});

and a main class :
/* ************************************************************************

#asset(variableaccess/*)

************************************************************************ */

qx.Class.define("variableaccess.Application",
{
  extend : qx.application.Standalone,
  members :
  {
    main : function()
    {
      this.base(arguments);
      var child = new variableaccess.Child();
      child.setRestricted(1);
      console.log(child.getRestricted());
    }
  }
});

Running it as "source", the console correctly outputs 1, where in "build" I get 
an "undefined".

Thanks!
-deech
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to