[fpc-pascal] Overriding or reimplementing a property
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Sat Mar 2 08:06:02 CET 2013
Marco van de Voort wrote:
> In our previous episode, Mark Morgan Lloyd said:
>> Given something like
>>
>> implementation
>>
>> var DBConnectionNearby: TSQLConnection= nil;
>>
>> ..
>> case MainForm.NearbyKind of
>> dbkFirebird: DBConnectionNearby := TIBConnection.Create(nil);
>> dbkPostgres: DBConnectionNearby := TPQConnection.Create(nil);
>>
>> is there an elegant way of overriding the Connected property to point to
>> code that can e.g. check that all prerequisite libraries are available
>> before trying to activate the object?
>
> Check the prequisite libraries yourself, and then if found, initialize the
> corresponding unit yourself:
>
> e.g. in the case of postgres3dyn using
>
> Function InitialisePostgres3(Const libpath : ansistring) : integer;
I'm doing that. What I'm checking is that I'm not overlooking some way
of declaring/implementing DBConnectionNearby, which can be either a
TIBConnection or a TPQConnection, with an extension to the Connected
property. I suppose that in effect it would be some variant of multiple
inheritance.
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list