Ambiguous reference when getter/setter have different visibilities

Posted by Warren Seine on Stack Overflow See other posts from Stack Overflow or by Warren Seine
Published on 2010-03-24T16:18:53Z Indexed on 2010/03/25 8:03 UTC
Read the original article Hit count: 382

The following code raises an ambiguous reference to value at compile time:

import flash.display.Sprite;

public class Main extends Sprite
{
    private var _value : Number = 0.;

    public  function get value() : Number           { return _value; }
    private function set value(v : Number) : void   { _value = v; }

    public function Main() : void
    {
        value = 42.;
    }
}

I suspect some kind of bug in the compiler, though I didn't actually read the ECMA standard.

Before someone asks those questions:

  • Private setters do make sense.
  • The ambiguity also exists with custom namespaces (which is the problem I'm facing).

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about visibility