Highlighted
Absent Member.
Absent Member.
386 views

Enum

Can you access enums in one class from another?  I have a models folder with some enum values setup in a class file.  I want to access those enums from within another class.  When I instantiate the class object (myClass type Stats value new Stats()), i was hoping to have access to the enum values, but intellisense does not seem to recognize them.

Thanks.

0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Enum

Hi, a couple of questions. Are you compiling to .NET or to JVM? What exactly do you mean when you say you have enum values in a class file? Do you have an enum definition nested within a class file, something like:
class-id a.
...
enum-id MyEnum
...
end enum.
end class.
...?
if so, when accessing the enum from outside of a, you will need to reference it as a nested type i.e. type a+MyEnum in this case.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Enum

that is exactly what i needed for it to work, the + sign. Thanks.
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Enum

Hi, a couple of questions. Are you compiling to .NET or to JVM? What exactly do you mean when you say you have enum values in a class file? Do you have an enum definition nested within a class file, something like:
class-id a.
...
enum-id MyEnum
...
end enum.
end class.
...?
if so, when accessing the enum from outside of a, you will need to reference it as a nested type i.e. type a+MyEnum in this case.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.