Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

OO: Extending FB_Init

2013-11-14
2013-11-18
  • DavidWSteadman - 2013-11-14

    I have a base class that I'd like to extend such that the subclass has extra parameters in its constructor.

    For the sake of brevity, I'll skip the class definitions and jump straight to the object declarations - I think it gets my point across:

    A : BaseClass (parameter := myParameterValueForA);
    B : BaseClass_Specialization_1 (parameter := myParameterValueForB, specializedParameter := mySpecializedParameterForB);
    

    However, CODESYS doesn't like the definition of BaseClass_Specialization_1.FB_Init because it doesn't match BaseClass.FB_Init. This is a standard thing to do with other OO languages, and I'm trying to figure out if I'm just missing something or if it's not supported.

    Any thoughts / suggestions?

     
  • singleton - 2013-11-15

    Hello,
    unfortunately CoDeSys does not support overloading.

     
  • DavidWSteadman - 2013-11-18

    Thanks, I was afraid that might be the case. Pity, that is quite a restriction for working with class hierarchies. I can understand not supporting overloading for regular methods, but for constructors it strikes me as kind of a big deal.

    Maybe it will turn up in future versions...

     

Log in to post a comment.