Hi,

Members with two underlines before it like yours: __restricted are
considered "private" and are not visible in the child class. If you want it
to be visible in your child class and no visible outside the class it needs
to be "protected". To do that, use just one underline before your variable
name, like: members: { _restricted: null }.

It works in the source version because it wasn't optimized and obfuscated
yet. The generator does that in the build job.

On Tue, Oct 26, 2010 at 4:31 PM, aditya siram <[email protected]>wrote:

> 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
>
>
------------------------------------------------------------------------------
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