By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,852 Members | 2,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,852 IT Pros & Developers. It's quick & easy.

enum type

P: n/a
Hi,

Is it possible to compare two enum variable?! Or should I
provide an operator method?! I mean..

....

public:
enum cdtype{ audio = 1, video =2 } cd_tpe;

....

if( a.getType() < b.getType )
return true;

....
Regards
Salvo
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

salvo wrote:
Hi,

Is it possible to compare two enum variable?! Or should I
provide an operator method?! I mean..

...

public:
enum cdtype{ audio = 1, video =2 } cd_tpe;

...

if( a.getType() < b.getType )
return true;

...
Regards
Salvo


Yes, you should be able to do this comparison. The enums will be
treated as numbers for the comparison.

Hope this helps,
-shez-

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.