-
1. Re: Getter Setter strange problem in interface
kglad Nov 4, 2014 1:02 PM (in response to vakhtangi)the first error i see is on line 3. someInt has no body.
-
2. Re: Getter Setter strange problem in interface
vakhtangi Nov 4, 2014 10:50 PM (in response to kglad)I don't understand, interface no need body
-
3. Re: Getter Setter strange problem in interface
kglad Nov 5, 2014 7:30 AM (in response to vakhtangi)oops, my error.
your 'so' variable should be of type SomeInt, not ISomeInt.
-
4. Re: Re: Getter Setter strange problem in interface
vakhtangi Nov 5, 2014 10:48 AM (in response to kglad)I think this is compiler error, IGet and ISet interfaces not compiles.
but my logic is correct
this case works
package { public interface ISomeInt { function get someInt():int; function set someInt(value:int):void; } -
5. Re: Getter Setter strange problem in interface
Amy Blankenship Nov 6, 2014 8:01 AM (in response to kglad)Just to chime in...I'm not sure how familiar vakhtangi is with AS and don't want him to get discouraged by wrong information by someone with a lot of reputation points. Typing it to the interface is the correct thing to do and changing to the implementation type won't help (and of course also won't accomplish the purpose of using Interfaces in the first place).
I think what actually happens is that the IGet and ISet are defined separately, then combined in ISomeInt. When trying to set the value, the compiler sees them as separate and is picking up the IGet first (that's the order you specified in ISomeInt), which does specify someInt as a read-only property. This is strange behavior, but not illogical. It's probably an edge case that never occurred to Macromedia/Adobe.



