Re: Adding a method to an enum.

2011-06-19 Thread Ali Çehreli
On Mon, 20 Jun 2011 02:48:30 +, Charles McAnany wrote: > 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{ >

Re: Adding a method to an enum.

2011-06-19 Thread Jonathan M Davis
On 2011-06-19 19:48, Charles McAnany wrote: > 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, u

Adding a method to an enum.

2011-06-19 Thread Charles McAnany
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){