Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > one enum is a subset of another

Reply
Thread Tools

one enum is a subset of another

 
 
Thomas Boell
Guest
Posts: n/a
 
      02-02-2012
On Thu, 02 Feb 2012 00:37:15 +0100
"Matt D." <> wrote:

> On 2/1/2012 14:08, Thomas Boell wrote:
> > You could do something like this:
> >
> > #define FRUIT_VALUES \
> > APPLE, \
> > BANANA, \
> > ORANGE
> >
> > enum Fruit
> > {
> > FRUIT_VALUES
> > };
> >
> > enum Things
> > {
> > FRUIT_VALUES,
> > BEERCAN, CAR, ALOT
> > };
> >
> > Whether using the preprocessor like this is "good style" depends on
> > your point of view.

>
> It's seems very much like inheritance, so it made me think that perhaps
> using something along the following could be of use:
> http://www.codeproject.com/Articles/...-a-C-enum-type


He forgot to start the NewFruits enum values after the end of Fruit, so
he will not be able to distinguish Apples from Oranges.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's a good way to find whether a hash is a subset of another hash (deep)? dblock Ruby 2 10-09-2011 08:37 PM
how to detect that one XML is a subset of another one? Phlip XML 6 04-23-2010 10:10 PM
The Easiest way to check if one array is a subset of another Thriving K. Ruby 2 08-04-2009 05:23 AM
How to test if one dict is subset of another? Jay Tee Python 15 02-20-2007 09:10 PM
Including an enum within another enum, possible? mrhicks C Programming 2 06-10-2004 03:00 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57