S
Yup, the last company where I worked I did a lot of OOP especially using thinks like Java, Ruby, C++, etc., and now I am programming in Structured Text. At least it's not LD.
Anyway, the short story is that I/d like to declare a global type so that I don't have to redeclare it in each function block. Something like...
TYPE CONTROL
STRUCT
A: INT;
B: BOOL;
END_STRUCT
END_TYPE
and in Main, declare...
VAR X: CONTROL; END_VAR
while in a function block,
VAR_IN_OUT Z: CONTROL ; END_VAR
...
Z.A := 4;
...
------------------
The idea is to create an object with attached methods. The problem, as I see it with function blocks is that each one represents a single method. But upon aggregation one could create a class with objects from it by instantiating the structure; I can live without inheritance because these codes are quite tame compared to a GUI implementation, for example.
However, this becomes quite difficult without the ability to create a global type declaration. I <i>know</i> it's possible, there are control structures defined in the AB libraries...
Perhaps I'm getting this whole idea quite wrong and should approach it from another direction.
-----------------
Anyway, the short story is that I/d like to declare a global type so that I don't have to redeclare it in each function block. Something like...
TYPE CONTROL
STRUCT
A: INT;
B: BOOL;
END_STRUCT
END_TYPE
and in Main, declare...
VAR X: CONTROL; END_VAR
while in a function block,
VAR_IN_OUT Z: CONTROL ; END_VAR
...
Z.A := 4;
...
------------------
The idea is to create an object with attached methods. The problem, as I see it with function blocks is that each one represents a single method. But upon aggregation one could create a class with objects from it by instantiating the structure; I can live without inheritance because these codes are quite tame compared to a GUI implementation, for example.
However, this becomes quite difficult without the ability to create a global type declaration. I <i>know</i> it's possible, there are control structures defined in the AB libraries...
Perhaps I'm getting this whole idea quite wrong and should approach it from another direction.
-----------------