Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / November 2007

Tip: Looking for answers? Try searching our database.

name conflicts in enum

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George - 02 Nov 2007 10:29 GMT
Hello everyone,

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

[Code]
enum foo {
         
         NAME = 100;
}

enum goo {
         
         NAME = 200;
}
[/Code]

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

thanks in advance,
George
Cholo Lennon - 02 Nov 2007 13:47 GMT
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

> Hello everyone,
>
[quoted text clipped - 18 lines]
> thanks in advance,
> George
Cholo Lennon - 02 Nov 2007 13:57 GMT
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

> 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.
[quoted text clipped - 28 lines]
> > thanks in advance,
> > George
George - 02 Nov 2007 16:19 GMT
Hi Cholo,

Could you recommend me a better newsgroup which is more suitable for my
question please? Thanks.

regards,
George

> 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
[quoted text clipped - 39 lines]
> > > thanks in advance,
> > > George
Cholo Lennon - 02 Nov 2007 16:49 GMT
- microsoft.public.vc.language
- microsoft.public.vc.atl (for your question about COM)

Regards

--
Cholo Lennon
Bs.As.
ARG

> Hi Cholo,
>
[quoted text clipped - 47 lines]
> > > > thanks in advance,
> > > > George
George - 03 Nov 2007 06:31 GMT
Thanks Cholo!

regards,
George

> - microsoft.public.vc.language
> - microsoft.public.vc.atl (for your question about COM)
[quoted text clipped - 57 lines]
> > > > > thanks in advance,
> > > > > George
George - 02 Nov 2007 16:19 GMT
Thanks Cholo,

It works! Cool!

regards,
George

> 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.
[quoted text clipped - 28 lines]
> > thanks in advance,
> > George

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.