Hello,
I am recently working on an project with a lot of OOP, and the use of the ABTRACT keyword is still not clear for me.
Here is my example:
I have 3 levels of execution and i want that every level write something in an IN_OUT structure.
My structure:
and finally my execution:
~~~
PROGRAM PLC_PRG
VAR
fbAplication: Level3;
stOne : St_Test;
xEnable: BOOL;
END_VAR
fbAplication(xEnableAll := xEnable, stInOut := stOne);
~~~
I want to achieve that whenever I call the level 3 function, I can see in my structure the changes from every level, Right now I only see like the only executed level is the level 3.
The reason that Im doing this is because I would like to have a functionX that need the same logic from level 1 and 2 but different at level 3
Could somebody help me to clarify this and how can I execute that with one call I have all the inheritance functions working.
Update:
I found that to execute the logic of inherited functions, the command SUPER^(stInOut :=stInOut) can execute the logic of the inherited function
π
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Keyword ABSTRACT means you may NOT instanciate that CLASS (FB) immediately, you must first derive it before usage! See co5e coList library home for a detailed example.
Search for Keywords THIS and SUPER which are special pointers.
THIS always points to your current instance, while SUPER will always point to the parent of the current instance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am recently working on an project with a lot of OOP, and the use of the ABTRACT keyword is still not clear for me.
Here is my example:
I have 3 levels of execution and i want that every level write something in an IN_OUT structure.
My structure:
My fb Level 1
My fb level 2
My fb level 3
and finally my execution:
~~~
PROGRAM PLC_PRG
VAR
fbAplication: Level3;
stOne : St_Test;
xEnable: BOOL;
END_VAR
fbAplication(xEnableAll := xEnable, stInOut := stOne);
~~~
I want to achieve that whenever I call the level 3 function, I can see in my structure the changes from every level, Right now I only see like the only executed level is the level 3.
The reason that Im doing this is because I would like to have a functionX that need the same logic from level 1 and 2 but different at level 3
Could somebody help me to clarify this and how can I execute that with one call I have all the inheritance functions working.
Update:
I found that to execute the logic of inherited functions, the command SUPER^(stInOut :=stInOut) can execute the logic of the inherited function
Keyword ABSTRACT means you may NOT instanciate that CLASS (FB) immediately, you must first derive it before usage! See co5e coList library home for a detailed example.
Search for Keywords THIS and SUPER which are special pointers.
THIS always points to your current instance, while SUPER will always point to the parent of the current instance.