Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Recently (weeks or months ago)there was an article that talked about adding additional properties to ENUMs. It discussed the fact that in C++ enum was a class and so could be extended. I bookmarked the article because it directly related to a project I was working on. Unfortunately I can no longer find the bookmark! Does anyone remember the article, or at least enough of to give me good search terms?

Thanks!

David
Posted

1 solution

Are you sure it was C++? Just in case: in November I published an article on the similar topic, but in .NET: Enumeration Types do not Enumerate! Working around .NET and Language Limitations[^].

I don't thing enumeration type can be extended. The approach is to wrap it in a class using generics and reflection. I don't know how to do it in C++ with templates and RTTI, as RTTI does not have the power of .NET reflection. If you find the article on the topic for C++, will you please notify me (by adding comment to this post)?

Sorry if this is not it.

—SA
 
Share this answer
 
Comments
Espen Harlinn 12-Jul-11 9:59am    
You're right - it was probably about java enums, my 5
Sergey Alexandrovich Kryukov 12-Jul-11 10:34am    
Thank you for the note! Java enums are very likely as they are much closer to .NET enum. I don't think it could be C++.
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900