Highlighted
Absent Member.
Absent Member.
1246 views

With Data Inheritance VC

Jump to solution

Is it possible to have inheritance  with data between Cobol.Net classes the same way that classes in  OOCobol do? If this isn't possible is there any workaround?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: With Data Inheritance VC

Jump to solution

I assume that when you are talking about OOCobol you are talking about Net Express native OO programs that use the Net Express class libraries is that correct?

The native OO syntax supported in Net Express is still supported in Visual COBOL but only for native code projects.

Managed code .NET projects have a new syntax and not all old constructs are supported.

INHERITS WITH DATA is one of those constructs that is not supported in the managed .NET syntax.

In managed code, all data items in a parent class that are declared as public are automatically inherited by a child class but in order to access these data items in the child class you would need to use the SUPER::mydataitem syntax.

If you were accessing a data item defined as a property in the parent class from a class that held an instance of the child class then you could access the data item using something like:

set myobject::mydataitem to ...

Is this what you are looking for?

View solution in original post

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: With Data Inheritance VC

Jump to solution

I assume that when you are talking about OOCobol you are talking about Net Express native OO programs that use the Net Express class libraries is that correct?

The native OO syntax supported in Net Express is still supported in Visual COBOL but only for native code projects.

Managed code .NET projects have a new syntax and not all old constructs are supported.

INHERITS WITH DATA is one of those constructs that is not supported in the managed .NET syntax.

In managed code, all data items in a parent class that are declared as public are automatically inherited by a child class but in order to access these data items in the child class you would need to use the SUPER::mydataitem syntax.

If you were accessing a data item defined as a property in the parent class from a class that held an instance of the child class then you could access the data item using something like:

set myobject::mydataitem to ...

Is this what you are looking for?

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: With Data Inheritance VC

Jump to solution

Thanks for the answer. The problem is the number of variables,  so is the effort of rewriting the code that scares me alot.  😞

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.