<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Abstract or Inheritance functions.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/34be24b298/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/34be24b298/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/34be24b298/</id><updated>2022-02-16T10:51:18.173000Z</updated><subtitle>Recent posts to Abstract or Inheritance functions.</subtitle><entry><title>Abstract or Inheritance functions.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/34be24b298/?limit=250#989c" rel="alternate"/><published>2022-02-16T10:51:18.173000Z</published><updated>2022-02-16T10:51:18.173000Z</updated><author><name>h-hermsen</name><uri>https://forge.codesys.com/u/hermsen/</uri></author><id>https://forge.codesys.com33800f2eba1fc5caa78d14e8276e49052f301fcf</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Keyword ABSTRACT means you may NOT instanciate that CLASS (FB) immediately, you &lt;em&gt;must&lt;/em&gt; first derive it before usage! See co5e coList library home for a detailed example.&lt;/p&gt;
&lt;p&gt;Search for Keywords THIS and SUPER which are special pointers.&lt;br/&gt;
THIS always points to your current instance, while SUPER will always point to the parent of the current instance.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Abstract or Inheritance functions.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/34be24b298/?limit=25#4b10" rel="alternate"/><published>2022-02-16T09:33:08.567000Z</published><updated>2022-02-16T09:33:08.567000Z</updated><author><name>alebrije</name><uri>https://forge.codesys.com/u/alebrije/</uri></author><id>https://forge.codesys.com4a06e24deeefd498581a6e1e0123da7799b23471</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Update:&lt;br/&gt;
I found that to execute the logic of inherited functions, the command SUPER^(stInOut :=stInOut) can execute the logic of the inherited function&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Abstract or Inheritance functions.</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/34be24b298/?limit=25#6dc5" rel="alternate"/><published>2022-02-16T07:09:32.374000Z</published><updated>2022-02-16T07:09:32.374000Z</updated><author><name>alebrije</name><uri>https://forge.codesys.com/u/alebrije/</uri></author><id>https://forge.codesys.comb9e4244ebd04938358c0017ed171660ebea94c25</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello, &lt;br/&gt;
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.&lt;br/&gt;
Here is my example:&lt;br/&gt;
I have 3 levels of execution and i want that every level write something in an IN_OUT structure.&lt;br/&gt;
My structure:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;TYPE St_Test :&lt;/span&gt;
&lt;span class="err"&gt;STRUCT&lt;/span&gt;
&lt;span class="err"&gt;    tLevel1 : TIME;&lt;/span&gt;
&lt;span class="err"&gt;    xLevel1 : BOOL;&lt;/span&gt;
&lt;span class="err"&gt;    tLevel2 : TIME;&lt;/span&gt;
&lt;span class="err"&gt;    xLevel2 : BOOL;&lt;/span&gt;
&lt;span class="err"&gt;    tLevel3 : TIME;&lt;/span&gt;
&lt;span class="err"&gt;    xLevel3 : BOOL;&lt;/span&gt;
&lt;span class="err"&gt;END_STRUCT&lt;/span&gt;
&lt;span class="err"&gt;END_TYPE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;My fb Level 1&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;FUNCTION_BLOCK&lt;/span&gt; &lt;span class="n"&gt;ABSTRACT&lt;/span&gt; &lt;span class="n"&gt;Level1&lt;/span&gt;
&lt;span class="n"&gt;VAR_INPUT&lt;/span&gt;
    &lt;span class="n"&gt;xEnableAll&lt;/span&gt;  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;BOOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="n"&gt;VAR_IN_OUT&lt;/span&gt;
    &lt;span class="n"&gt;stInOut&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;St_Test&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;

&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;xEnableAll&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
    &lt;span class="n"&gt;stInOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tLevel1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TIME&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;stInOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xLevel1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;TRUE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;My fb level 2&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;FUNCTION_BLOCK&lt;/span&gt; &lt;span class="n"&gt;ABSTRACT&lt;/span&gt; &lt;span class="n"&gt;Level2&lt;/span&gt; &lt;span class="n"&gt;EXTENDS&lt;/span&gt; &lt;span class="n"&gt;Level1&lt;/span&gt;

&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;xEnableAll&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
    &lt;span class="n"&gt;stInOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tLevel2&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TIME&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;stInOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tLevel1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;stInOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xLevel2&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;TRUE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;My fb level 3&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;FUNCTION_BLOCK&lt;/span&gt; &lt;span class="k"&gt;PUBLIC&lt;/span&gt; &lt;span class="n"&gt;Level3&lt;/span&gt; &lt;span class="n"&gt;EXTENDS&lt;/span&gt; &lt;span class="n"&gt;Level2&lt;/span&gt;

&lt;span class="k"&gt;IF&lt;/span&gt; &lt;span class="n"&gt;xEnableAll&lt;/span&gt; &lt;span class="k"&gt;THEN&lt;/span&gt;
    &lt;span class="n"&gt;stInOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tLevel3&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TIME&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;stInOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tLevel2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;stInOut&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xLevel3&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;TRUE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;and finally my execution:&lt;br/&gt;
 ~~~&lt;br/&gt;
PROGRAM PLC_PRG&lt;br/&gt;
VAR&lt;br/&gt;
    fbAplication: Level3;&lt;br/&gt;
    stOne   : St_Test;&lt;br/&gt;
    xEnable: BOOL;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;fbAplication(xEnableAll := xEnable, stInOut := stOne);&lt;br/&gt;
~~~&lt;br/&gt;
 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. &lt;br/&gt;
 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&lt;br/&gt;
 Could somebody help me to clarify this and how can I execute that with one call I have all the inheritance functions working.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>