Jeppe Græsdal Johansen wrote:
I find that if I explicitly decorate TB5500BaseUnit.Create() as
virtual and TB5500SPOUnit.Create() as override then
TB5500SPOUnit.Create() is called correctly. I didn't think this was
necessary, but on reflection I assume that it's because u is declared
as a TB5500BaseUnit: the variable's compile-time rather than run-time
class is being used for the constructor unless explicitly overridden.
Is there an obvious way of tiying this up that I'm overlooking?
You have forgotten to declare the constructor virtual.
I said I'd fixed it by declaring the constructor virtual, but that I'm
not entirely confident in my understanding of why that's necessary.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal