Journal Articles
Browse in : |
All
> Journals
> CVu
> 123
(22)
All > Topics > Programming (877) Any of these categories - All of these categories |
Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.
Title: Adding Enumerators
Author: Administrator
Date: 03 May 2000 13:15:36 +01:00 or Wed, 03 May 2000 13:15:36 +01:00
Summary:
Body:
From time to time I get asked how to add an extra enumerator to an already existing enum type. After you have finished thinking how easy that is as all you need is to type it into the existing definition ask about the context.
The context is extending an enum in a base class for use in a derived class. Changing the definition of a class that you do not own is unwise even if it works (adding friends, enums, typedefs etc. to the class definition almost always works but it is unprofessional unless you are the class designer).
However, there is no problem if all you want is the functionality of an extra enumeration in the derived class. Enumerations are only named values of the enum type. Consider:
enum example {val1, val2, max_example=INT_MAX}; const example val3 = 2;
The compiler should treat val1, val2 and val3 identically. However, note the limit value enumeration. An enum designed for extension needs that guard in C++.
Notes:
More fields may be available via dynamicdata ..