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.
Avoiding obligatory SUPER constructor call
Avoiding obligatory SUPER constructor call
Hi Serggio,
Just use something like that in your child's class constructor:
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
Just use something like that in your child's class constructor:
Code: Select all
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
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Avoiding obligatory SUPER constructor call
Thank you very much, Chris! That should save me a lot of time.