[haXe] Getter & Setter problems
Axel Huizinga
axel at 3drachen.de
Wed Aug 1 06:59:11 CEST 2007
Luke Schreur schrieb:
>
> Hi guys,
>
> First post to this list so please be gentle. I've run into a problem
> with getter and setters. I actually wanted to create a singleton with
> static getter and setters but I already had issues with getting the
> example of the haXe site up and running. I'm getting the following
> error and I'm sure its my mistake but I can't seem to be able to see it:
>
> ./src/Test.hx:7: characters 8-31 : In method setX required by property x
> ./src/Test.hx:7: characters 8-31 : x : Int -> Void should be Int -> Int
> ./src/Test.hx:7: characters 8-31 : Void should be Int
>
> class Test
> {
> public var x(getX,setX) : Int; // this is line 7
>
>
> private var m_x : Int;
>
>
> private function getX()
> {
> return( m_x );
> }
>
>
> private function setX( x : Int )
> {
> m_x = x;
here you forgot:
return m_x;
> }
> }
>
> I'm running haxe-1.14-osx. Anyone an idea?
>
> Thanks.
>
More information about the Haxe
mailing list