Simple Codesys OOP - Inheritance

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ต.ค. 2024
  • 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. :)

ความคิดเห็น • 10

  • @StefanBrock_PL
    @StefanBrock_PL 11 หลายเดือนก่อน +1

    Very nicely presented. Interesting first part, well chosen examples. The second part, with the pumps, a little unconvincing :-)

    • @chlow1627
      @chlow1627  11 หลายเดือนก่อน

      Thanks for the feedback. On hindsight, the video should have built towards an example with the pump. Will keep in mind for future video

  • @amywilliams1021
    @amywilliams1021 6 หลายเดือนก่อน

    Great example! Easy to understand and conveyed the points clearly, thank you

  • @邱紀戰
    @邱紀戰 3 หลายเดือนก่อน

    so good for expanding OOP

  • @seimela
    @seimela หลายเดือนก่อน

    Cool

  • @nathanives1269
    @nathanives1269 9 หลายเดือนก่อน

    Thank you.

  • @seimela
    @seimela 28 วันที่ผ่านมา

    We are lot of subscribers 😊😂❤

  • @TusharK-ln8ki
    @TusharK-ln8ki 2 หลายเดือนก่อน

    Sir ,can you give me the backup?

  • @programming_tic
    @programming_tic ปีที่แล้ว

    Thanks🙏