all groups > visual c > november 2007 >
You're in the visual c group:
name conflicts in enum
visual c:
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 [quoted text, click to view] "George" <George@discussions.microsoft.com> wrote in message news:884912D5-4C39-4793-AA85-402B80C5737E@microsoft.com... > 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
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 [quoted text, click to view] "Cholo Lennon" <chololennon@hotmail.com> wrote in message news:#cdh72UHIHA.5980@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" <George@discussions.microsoft.com> wrote in message > news:884912D5-4C39-4793-AA85-402B80C5737E@microsoft.com... > > 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 > >
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,
Hi Cholo, Could you recommend me a better newsgroup which is more suitable for my question please? Thanks. regards, George [quoted text, click to view] "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" <chololennon@hotmail.com> wrote in message > news:#cdh72UHIHA.5980@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" <George@discussions.microsoft.com> wrote in message > > news:884912D5-4C39-4793-AA85-402B80C5737E@microsoft.com... > > > 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 > > > > > >
Thanks Cholo, It works! Cool! regards, George [quoted text, click to view] "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" <George@discussions.microsoft.com> wrote in message > news:884912D5-4C39-4793-AA85-402B80C5737E@microsoft.com... > > 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 > >
- microsoft.public.vc.language - microsoft.public.vc.atl (for your question about COM) Regards -- Cholo Lennon Bs.As. ARG [quoted text, click to view] "George" <George@discussions.microsoft.com> wrote in message news:CBC5E930-527A-41C7-876E-48640988AF1B@microsoft.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" <chololennon@hotmail.com> wrote in message > > news:#cdh72UHIHA.5980@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" <George@discussions.microsoft.com> wrote in message > > > news:884912D5-4C39-4793-AA85-402B80C5737E@microsoft.com... > > > > 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 > > > > > > > > > > > >
Thanks Cholo! regards, George [quoted text, click to view] "Cholo Lennon" wrote: > - microsoft.public.vc.language > - microsoft.public.vc.atl (for your question about COM) > > Regards > > -- > Cholo Lennon > Bs.As. > ARG > > > "George" <George@discussions.microsoft.com> wrote in message news:CBC5E930-527A-41C7-876E-48640988AF1B@microsoft.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" <chololennon@hotmail.com> wrote in message > > > news:#cdh72UHIHA.5980@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" <George@discussions.microsoft.com> wrote in message > > > > news:884912D5-4C39-4793-AA85-402B80C5737E@microsoft.com... > > > > > 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 > > > > > > > > > > > > > > > > > > >
Don't see what you're looking for? Try a search.
|
|
|