[fpc-pascal]Class Identification?

Anton Tichawa anton.tichawa at chello.at
Sun Mar 23 16:01:38 CET 2003


hi, Jon!

> Heya ^_^  Is it possible to identify the class type?
>
> For example TypeOf(MyClass) = TypeOf(MyClass)?
>
> Is it possible to register diffrent types of classes at startup and then
> identify them later?
>
> This is probably a simple matter solvable with a few calls from the
> System unit that are well documented.  But honestly.. I didn't see any!
> ^_^
>
>
> Any hints/suggestions would be much appreciated.

for descendants of TObject, there's a method 'ClassType', e. g.

***
begin
  if MyObject.ClassType = CCalculator then begin
    bla bla
  end else bla bla
end;
***

see reference manual - system unit. this only works if a descendant of 
TObject has been assigned to MyObject.

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: anton.tichawa at chello.at

----------



More information about the fpc-pascal mailing list