摘要 |
A system and method are provided that facilitate use of an object-oriented enumerated type within a computer program. During operation, the system receives source code for the computer program. The source code contains a declaration for an enumerated type. This declaration specifies a fixed number of enumeration constants that comprise the enumerated type. Next, the system defines the enumerated type using a class defined within an object-oriented programming language. The class includes a constant for each enumeration constant specified in the declaration. If the declaration additionally contains one or more method declarations, these methods are present on the defined class. |