473,386 Members | 1,962 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,386 software developers and data experts.

name conflicts in enum

Hello everyone,
Suppose I have two enums which has an item with the same names -- but
different values,

Expand|Select|Wrap|Line Numbers
  1. enum foo {
  2.  
  3. NAME = 100;
  4. }
  5.  
  6. enum goo {
  7.  
  8. NAME = 200;
  9. }
  10.  
Are there any ways to specify whether I need to access NAME in foo or NAME
in goo?
thanks in advance,
George
Nov 2 '07 #1
6 1405
You have to put them in different namespaces, otherwise the code doesn't
compile. If you do that, you can refer enum values using namespace name.

Regards

--
Cholo Lennon
Bs.As.
ARG
"George" <Ge****@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
Hello everyone,
Suppose I have two enums which has an item with the same names -- but
different values,

Expand|Select|Wrap|Line Numbers
  1. enum foo {
  2.           NAME = 100;
  3. }
  4. enum goo {
  5.           NAME = 200;
  6. }
  7.  

Are there any ways to specify whether I need to access NAME in foo or NAME
in goo?
thanks in advance,
George

Nov 2 '07 #2
BTW... this is a newsgroup for C++ CLI so I suppose that you're using it. You
can use 'enum class' instead of C++ enum. Enum class values don't have the
problem of scope visibility (present in C++ enum values).

Regards

--
Cholo Lennon
Bs.As.
ARG
"Cholo Lennon" <ch*********@hotmail.comwrote in message
news:#c**************@TK2MSFTNGP04.phx.gbl...
You have to put them in different namespaces, otherwise the code doesn't
compile. If you do that, you can refer enum values using namespace name.

Regards

--
Cholo Lennon
Bs.As.
ARG
"George" <Ge****@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
Hello everyone,
Suppose I have two enums which has an item with the same names -- but
different values,

Expand|Select|Wrap|Line Numbers
  1.  enum foo {
  2.  
  3.            NAME = 100;
  4.  }
  5.  
  6.  enum goo {
  7.  
  8.            NAME = 200;
  9.  }
  10.  
Are there any ways to specify whether I need to access NAME in foo or NAME
in goo?
thanks in advance,
George


Nov 2 '07 #3
Thanks Cholo,
It works! Cool!
regards,
George

"Cholo Lennon" wrote:
You have to put them in different namespaces, otherwise the code doesn't
compile. If you do that, you can refer enum values using namespace name.

Regards

--
Cholo Lennon
Bs.As.
ARG
"George" <Ge****@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
Hello everyone,
Suppose I have two enums which has an item with the same names -- but
different values,

Expand|Select|Wrap|Line Numbers
  1.  enum foo {
  2.  
  3.            NAME = 100;
  4.  }
  5.  
  6.  enum goo {
  7.  
  8.            NAME = 200;
  9.  }
  10.  
Are there any ways to specify whether I need to access NAME in foo or NAME
in goo?
thanks in advance,
George


Nov 2 '07 #4
Hi Cholo,
Could you recommend me a better newsgroup which is more suitable for my
question please? Thanks.
regards,
George

"Cholo Lennon" wrote:
BTW... this is a newsgroup for C++ CLI so I suppose that you're using it. You
can use 'enum class' instead of C++ enum. Enum class values don't have the
problem of scope visibility (present in C++ enum values).

Regards

--
Cholo Lennon
Bs.As.
ARG
"Cholo Lennon" <ch*********@hotmail.comwrote in message
news:#c**************@TK2MSFTNGP04.phx.gbl...
You have to put them in different namespaces, otherwise the code doesn't
compile. If you do that, you can refer enum values using namespace name.

Regards

--
Cholo Lennon
Bs.As.
ARG
"George" <Ge****@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
Hello everyone,
>
>
Suppose I have two enums which has an item with the same names -- but
different values,
>
Expand|Select|Wrap|Line Numbers
  1.  enum foo {
  2.  >
  3.            NAME = 100;
  4.  }
  5.  >
  6.  enum goo {
  7.  >
  8.            NAME = 200;
  9.  }
  10.  
>
Are there any ways to specify whether I need to access NAME in foo or NAME
in goo?
>
>
thanks in advance,
George


Nov 2 '07 #5
- microsoft.public.vc.language
- microsoft.public.vc.atl (for your question about COM)

Regards

--
Cholo Lennon
Bs.As.
ARG
"George" <Ge****@discussions.microsoft.comwrote in message news:CB**********************************@microsof t.com...
Hi Cholo,
Could you recommend me a better newsgroup which is more suitable for my
question please? Thanks.
regards,
George

"Cholo Lennon" wrote:
BTW... this is a newsgroup for C++ CLI so I suppose that you're using it. You
can use 'enum class' instead of C++ enum. Enum class values don't have the
problem of scope visibility (present in C++ enum values).

Regards

--
Cholo Lennon
Bs.As.
ARG
"Cholo Lennon" <ch*********@hotmail.comwrote in message
news:#c**************@TK2MSFTNGP04.phx.gbl...
You have to put them in different namespaces, otherwise the code doesn't
compile. If you do that, you can refer enum values using namespace name.
>
Regards
>
--
Cholo Lennon
Bs.As.
ARG
>
>
"George" <Ge****@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
Hello everyone,


Suppose I have two enums which has an item with the same names -- but
different values,

Expand|Select|Wrap|Line Numbers
  1.   enum foo {
  2.  
  3.             NAME = 100;
  4.   }
  5.  
  6.   enum goo {
  7.  
  8.             NAME = 200;
  9.   }
  10.  
Are there any ways to specify whether I need to access NAME in foo or NAME
in goo?


thanks in advance,
George
>
>

Nov 2 '07 #6
Thanks Cholo!
regards,
George

"Cholo Lennon" wrote:
- microsoft.public.vc.language
- microsoft.public.vc.atl (for your question about COM)

Regards

--
Cholo Lennon
Bs.As.
ARG
"George" <Ge****@discussions.microsoft.comwrote in message news:CB**********************************@microsof t.com...
Hi Cholo,
Could you recommend me a better newsgroup which is more suitable for my
question please? Thanks.
regards,
George

"Cholo Lennon" wrote:
BTW... this is a newsgroup for C++ CLI so I suppose that you're using it. You
can use 'enum class' instead of C++ enum. Enum class values don't have the
problem of scope visibility (present in C++ enum values).
>
Regards
>
--
Cholo Lennon
Bs.As.
ARG
>
>
"Cholo Lennon" <ch*********@hotmail.comwrote in message
news:#c**************@TK2MSFTNGP04.phx.gbl...
You have to put them in different namespaces, otherwise the code doesn't
compile. If you do that, you can refer enum values using namespace name.

Regards

--
Cholo Lennon
Bs.As.
ARG


"George" <Ge****@discussions.microsoft.comwrote in message
news:88**********************************@microsof t.com...
Hello everyone,
>
>
Suppose I have two enums which has an item with the same names -- but
different values,
>
Expand|Select|Wrap|Line Numbers
  1.   enum foo {
  2.   >
  3.             NAME = 100;
  4.   }
  5.   >
  6.   enum goo {
  7.   >
  8.             NAME = 200;
  9.   }
  10.  
>
Are there any ways to specify whether I need to access NAME in foo or NAME
in goo?
>
>
thanks in advance,
George


>
>
>


Nov 3 '07 #7

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

Similar topics

7
by: mcdonamw | last post by:
This may sound like a stupid stupid question and I figure it would b more "general" than pertaining to a specific Language. I'm using vb.net and I have a bunch of Const values in my program. can...
12
by: christopherlmarshall | last post by:
Suppose you want to write a subclass of some existing class you are importing from a module you didn't write and that you don't want to study the internals of, and you want to define a data member...
2
by: LoopyNZ | last post by:
Hi, (Access 97) I'm creating a query (QRY_SUMMARY) to join a query (QRY) to itself (QRY_1). I'm returning QRY.* and selected fields from QRY_1. With each field (field_name) I return from...
5
by: Alex Stevens | last post by:
Hi All, In the absence of any predefined standards, I was wondering how to name and implement my enum in a class. My dilema is: When I (for example) have an integer property in my class...
13
by: Don | last post by:
How do I get an Enum's type using only the Enum name? e.g. Dim enumType as System.Type Dim enumName as String = "MyEnum" enumType = ???(enumName)
5
by: thetrueaplus | last post by:
Hey. I'm trying to make a couple of enums work, however mingW isn't compiling it because it says the previous declaration of none conflicts. is there a way to solve this? namespace Namespace...
6
by: Rico | last post by:
Hello, I'm looking for a way to reference the string name of an enumerator. I know in VB.net you can do "MyEnum.ToString" and get the name instead of the integer value. Is there a way I can do...
5
by: Sin Jeong-hun | last post by:
Hello. Speical folders, like Desktop, usually have different display names. For example, in Japanese Windows, it's displayed as "$B%G%9%/%H%C%W(B". I want to get the this displayed name of a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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...

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.