![]() |
Инициализация полей-объектов
вот такая вот вещь. есть два класаа
Код:
class Class1Код:
var obj11 : Class1 = new Class1(); |
почему так записали:
Цитата:
Код:
var obj11 : Class1 = new Class1(); |
сори, очепяточка. поправил
|
В твоем примере ничего не противоречит. Выдержка из хэлпа на эту тему: "When you initialize properties inline, the expression on the right side of an assignment must be a compile-time constant. That is, the expression cannot refer to anything that is set or defined at runtime. Compile-time constants include string literals, numbers, Boolean values, null, and undefined, as well as constructor functions for the following top-level classes: Array, Boolean, Number, Object, and String."
" == equality operator -- Variables representing objects, arrays, and functions are compared by reference. Two such variables are equal if they refer to the same object, array, or function." Почему такой результат, я хз. |
Это баг в AS2. Запись
Код:
public var object : Object = new Object();Код:
trace (obj11.object == obj12.object);Поэтому надо все значение присваивать в конструкторе. |
Цитата:
|
| Часовой пояс GMT +4, время: 00:32. |
Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.