Simple Codesys OOP - Inheritance

Pubblicato il: 29 dicembre 2022
sul canale di: CH Low
8,864
101

In Codesys, Object Oriented Programing (OOP) is implemented through Function Blocks.
A critical part of OOP is Inheritance, and this is done by "extending" the function block.

TLDW:
1. The derived class 'Son' inherit all variables and methods from the base class "Father'
2. You may add extra methods to the Son and also overwrite methods inherited from the Father
3. After overwriting the inherited methods, you can still use the method from Father using the SUPER pointer
4. Use OOP when you have many similar kind of sensors or actuators. (Like a motor class can split into Pumps, HVAC, grinders...) Fixing bugs in the base class will fix the same problem in all the classes that inherit from it. Reduce need to copy and paste

Sorry for long video
Maybe I should do one video on interfaces next time. :)


In questa pagina del sito puoi guardare il video online Simple Codesys OOP - Inheritance della durata di ore minuti seconda in buona qualità , che l'utente ha caricato CH Low 29 dicembre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 8,864 volte e gli è piaciuto 101 spettatori. Buona visione!