473,394 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

nested enum

a
Is it possible to do a nested enum?
For example,
private enum inside0{a,b,c}
private enum inside1{d,e,f}
private enum outside{inside0, inside1}

outside _variable=outside.inside0.a; //error here, but want a similar way

Is it possible to set the _variable in the way similar to the above?
Thanx
Aug 30 '05 #1
2 8211
a wrote:
Is it possible to do a nested enum?
For example,
private enum inside0{a,b,c}
private enum inside1{d,e,f}
private enum outside{inside0, inside1}

outside _variable=outside.inside0.a; //error here, but want a similar way

Is it possible to set the _variable in the way similar to the above?
Thanx

I do not have the answer but I would recommend you ask this question in
the comp.lang.programmer newsgroup.

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com
__________________________________________________ ________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Aug 30 '05 #2

"a" <a@mail.com> wrote in message news:LPOQe.331380$5V4.307125@pd7tw3no...
Is it possible to do a nested enum?
For example,
private enum inside0{a,b,c}
private enum inside1{d,e,f}
private enum outside{inside0, inside1}

outside _variable=outside.inside0.a; //error here, but want a similar
way

Is it possible to set the _variable in the way similar to the above?


There's a fundamental misunderstanding about enums here. In the above
example, no nesting is occuring. In the outer namespace, you have an enum
called "inside0", and inside the namespace of the enum outside, you have an
instance called "inside0". The code above is similar to this:

public class inside0 {
public final inside0 a = new inside0();
public final inside0 b = new inside0();
public final inside0 c = new inside0();
}

public class inside1 {
public final inside1 d = new inside1();
public final inside1 e = new inside1();
public final inside1 f = new inside1();
}

public class outside {
public final outside inside0 = new outside();
public final outside inside1 = new outside();
}

As you can see from this code, you have a class named inside0, and you have
a field named inside0, and they each refer to distinct things.

- Oliver
Aug 30 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: tapeesh | last post by:
I created a C file say struct.c with the following structure declarations in the same file struct A { union key { int i; float f; }k1;
11
by: Alfonso Morra | last post by:
Hi, I have the ff data types : typedef enum { VAL_LONG , VAL_DOUBLE , VAL_STRING , VAL_DATASET }ValueTypeEnum ;
6
by: B0nj | last post by:
I've got a class in which I want to implement a property that operates like an indexer, for the various colors associated with the class. For instance, I want to be able to do 'set' operations...
5
by: Steven Blair | last post by:
Hi, As the title suggests, I am looking for soemthing which would essentially give me a nested enum, or perhaps someone can suggest a more suitable approach to my problem. I have a DLL which...
3
by: G Patel | last post by:
Compiler won't let me nest switch statements with common labels inside them (in the cases). Why is this a problem (either in terms of standard or in terms of compiler's ability to make sense of...
1
by: Nike | last post by:
I have a small question w.r.t nested class.. I see in many codes nested classes are declared as public.. First, of all my understanding is that you go in for a nested class if you are sure that...
0
by: rgettman | last post by:
Hello, I'm attempting to use Pro*C to create a nested table and send that data to a stored procedure as a parameter. However, I'm getting a Pro*C compiler error that I'll describe below. I'm...
1
by: borophyll | last post by:
The C standard talks about nested declarators, and th only example of nested declarators I can think of are function parameter declarations, which are nested within the function declaration. Are...
2
by: John Doe | last post by:
Hi, I am trying to port some C class routines into C++. THe original functions are use to set/get properties of buttons inside a toolbar : // This function is used to set btton text //...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.