Hi, all. I'm looking for a way to make constants that have methods
without a lot of overhead. In particular, a way to define a
Direction and then be able to rotate it right. Here's kind of what I
have in mind:
enum Direction{
left, right, up, down;
public Direction rotateRight(){
switch(this){
case left:
return up;
case up:
return right;
case right:
return down;
case down:
return left;
}
}
The best I can think of is to make a new method, which isn't
terrible, but not elegant, either.
Any thoughts?
Thanks,
Charles.