hxcs icon indicating copy to clipboard operation
hxcs copied to clipboard

Fields initialization

Open Yoshimitsu77 opened this issue 8 years ago • 0 comments

after targeting C#, all fields initializations are moved into class's constuctor, and puts after calling constructor of super class. In most of all cases it;s fine, but here is onle example, that will not work: class b {} class a extends b {public var test:Int = 1;} If class b represents some kind of deserializator (from json-type string, for example), it will initialize some fields, implemented in class a, using reflection. so:

  1. constructor of class 'a' calls constroctor of class 'b'
  2. class 'b' deserializes data, and initializes field 'test' of class 'a'
  3. class 'a' replases data from field 'test' with default '1';

Yoshimitsu77 avatar Jan 30 '17 07:01 Yoshimitsu77