[fpc-pascal] Case based on type

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Mar 1 23:35:52 CET 2013


Given a procedure definition like

procedure checkLibrariesAndConnect(db: TSQLConnection);

is there a more elegant way of performing type-specific actions than

begin
   if db is TPQConnection then begin
   end;
   if db is TIBConnection then begin
   end
end { checkLibrariesAndConnect } ;

i.e. something like  case TypeOf(db)  ?

-- 
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