views:

297

answers:

1

I am trying to do the following:

public class character extends entity {
public const type:int = CHARACTER;
}


public class entity extends Sprite {
public const type:int = INVALID;

public const INVALID:int = -1;
public const CHARACTER:int = 1;
}

But the compiler throws:

Error: A conflict exists with inherited definition dieEngine:entity.type in namespace public. public const type:int = CHARACTER;

+2  A: 

well, constants are constants no matter if they are inherited or not and should not be overriden, think of that like the a complete class which defines two times the required constant.

If you really want to override it, you should set that varinstead of const

Use:

public var type:int = INVALID;

instead of:

public const type:int = INVALID;
jpabluz
Well, a constant should be able to be overwritten at compile time :/
M28
just use a vars with ALL_CAPS names.
aib