Why is this a compilation of property / function conflicts in AS3?

In ActionScript 3.0, this compiles:

public function set func(value:Function):void
{

}

public function func():void
{

}

It does not mean:

public function set someVar44(value:int):void
{

}

var someVar44:int;

Why is the first compiled? I believe it is possible that Adobe specifically and arbitrarily decided to block this for variables and allow it to execute functions, but allowing it for any functions or variables does not seem to make any sense. I'm suspicious here. What I do not see?

+3
source share
2 answers

This is really interesting, and he spent a lot of money to go down (although the answer seems painfully obvious).

, / . set function someVar44() someVar44 ( ). , :

public function get func(value:Function):void
{

}

. , set ? , , , , . , , - , .

:

public function set func(value:Function):void

- , (.. , var func.), .

adobe:

set Defines a setter, which is a method that appears in the public interface as a property.

get Defines a getter, which is a method that can be read like a property.

, set. , , func(). , this.func = function():void { }, :

# 1037: func

+2

, ( ). obj.func -, obj.func . , , , .

var ( internal, , ), , , . , - obj.someVar44 , ? .

0

All Articles