4 Replies Latest reply on Apr 21, 2011 8:53 PM by Yateam

    Unable to override property

    Yateam

      Hi all,

       

      I got a strange problem for which I can not find any explanations. So I have three classes, all of them are marked with [Bindable] tag. Below is the code:

      [Bindable]
      public class A
      {
           public function A()
           {
           }
           
           private var _testProp:int;
           public function get testProp():int
           {
                return _testProp;
           }
      
           public function set testProp(value:int):void
           {
                _testProp = value;
           }
      
      }
      

       

      [Bindable]
      public class B extends A
      {
           public function B()
           {
                super();
           }
           
           private var _testProp:int;
           override public function get testProp():int
           {
                return _testProp;
           }
           
           override public function set testProp(value:int):void
           {
                _testProp = value;
           }
      }
      

       

      [Bindable]
      public class C extends B
      {
           public function C()
           {
                super();
           }
           
           private var _testProp:int;
           override public function get testProp():int
           {
                return _testProp;
           }
           
           override public function set testProp(value:int):void
           {
                _testProp = value;
           }
      }
      

       

      When you try to compile it you will get the compilation error in class C:

      Multiple markers at this line:
      -1024: Overriding a function that is not marked for override.
      -overrides studyareas.B.testProp
      

       

      However, if I remove [Bindable] tag from class C the error will disappear.

       

      What does this mean? I did not find any official docs on this. Can anyone explain such behavoir of Flex compiler?

       

      Thanks.