Hello, Olle!

One possibility is:

type
  TClassA = class(TObject);

Your classes then inherit all methods of TObject, including TObject.ClassType 
and TObject.InheritsFrom. So it's possible to write things like:

procedure P(x: TClassA);
begin
  if x.ClassType = TClassA then begin
    bla bla
  end else if x.ClassType = TClassB then begin
    bla bla
  end;
  if x.InheritsFrom(TClassC) then begin
    // true for TClassC and descendants
    bla bla
  end;
end;

hth,

Anton.

----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte 
Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email: [EMAIL PROTECTED]

----------
_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to