Highlighted
Absent Member.
Absent Member.
1553 views

Static Classes in COBOL.Net

Jump to solution

[Migrated content. Thread originally posted on 19 January 2011]

How do we define Static classes in COBOL.Net? I am looking for equivalent of C# or Java. I see that we can define static blocks and also can specify static attribute on methods, but ran into some issues when I used static block. I am using Visual COBOL R3 (Beta).

Thanks!
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: Static Classes in COBOL.Net

Jump to solution
I don’t think you can create a static class in COBOL but...

My understanding is that a static class simply indicates the class contains only static members AND cannot be instantiated.

So I suppose you could simulate this by hiding the constructor, NEW(), and then declare your static members.

But you mentioned you encountered issues with static blocks – could you elaborate?

Scot

View solution in original post

0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: Static Classes in COBOL.Net

Jump to solution
I don’t think you can create a static class in COBOL but...

My understanding is that a static class simply indicates the class contains only static members AND cannot be instantiated.

So I suppose you could simulate this by hiding the constructor, NEW(), and then declare your static members.

But you mentioned you encountered issues with static blocks – could you elaborate?

Scot

View solution in original post

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.