enum type

S

salvo

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
 
S

Shezan Baig

salvo said:
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-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,201
Messages
2,571,048
Members
47,650
Latest member
IanTylor5

Latest Threads

Top