What is the best way to work with static variables in java/c++/c/actionscript-3 applications? -
i'm working on application using static variables (eg: pixel width of tile, or how many tiles want in array).
i have them declared in class defines object, example tilewidth in tileclass. using width in multiple other classes, , bugged fact have import whole tile class access field. there performance loss this?
is better practice hold static variables (they constants) in separate class , import whenever need variable?
is there other better way using static variables?
thanks
is better practice hold static variables (they constants) in separate class , import whenever need variable?
just put constants in interface
, reference them using interface. there no performance impact such put design rather creating class constants , making them public static (as variables defines in interface implicitly public default , static
).
Comments
Post a Comment