[fpc-pascal]Class Identification?

Sebastian G√ľnther sguenther at gmx.de
Sun Mar 23 16:52:41 CET 2003


On Sun, 2003-03-23 at 16:00, Jon David Sawyer wrote:
> > 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.
> Thanks. ^_^  I just maid my base class a descendant of TObject and that 
> took care of it!


btw, all classes are implicit descendants of TObject. If you don't
specify any base class, the class will be derived from TObject directly:

type
  TMyClass = class
    procedure Something;
    ...
  end;

TMyClass is automatically inherited from TObject

Both postings sound like this wasn't clear...


- Sebastian




More information about the fpc-pascal mailing list