Welcome, Guest
Username: Password: Remember me
Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET
  • Page:
  • 1

TOPIC:

Avoiding obligatory SUPER constructor call 12 May 2020 17:28 #14536

  • Serggio
  • Serggio's Avatar
  • Topic Author


  • Posts: 45
  • Is there any way to avoid calling SUPER constructor in a constructor of an inherited class?
    There are situations when SUPER constructor is of totally different nature and simply may not be called and should be completely overriden.
    I know, that's not very OOP-ish and one should use interface or something like that to untie that properly.
    But. The question I'm asking is not just the point of mere interest but a, so to say, decision input, because refactoring price and changing OOP-model seem to be quite costly.

    Please Log in or Create an account to join the conversation.

    Avoiding obligatory SUPER constructor call 12 May 2020 20:51 #14540

    • Chris
    • Chris's Avatar


  • Posts: 3844
  • Hi Serggio,

    Just use something like that in your child's class constructor:

    CONSTRUCTOR()
    	IF FALSE
    		SUPER()
    	END IF
    	// .normal code
    RETURN


    the compiler will detect you are handling SUPER() yourself and will not add implicitly code to call it. But please just don't show the above X# trick to any c# guy, because they will sue us for breaking every OOP law available :)
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Avoiding obligatory SUPER constructor call 12 May 2020 21:19 #14541

    • Serggio
    • Serggio's Avatar
    • Topic Author


  • Posts: 45
  • Thank you very much, Chris! That should save me a lot of time.

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1