[fpc-pascal] "is" for class references

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Fri Apr 8 13:22:22 CEST 2011

Is there an equivalent to "is" for class references?

type    CNodeContent= class of TNodeContent;

   procedure walkContent(node: CNodeContent);

     Write(PadRight(OidToStr(node.GetOid), 32));
     if node is TScalar then
       Write('  s');

Compilation fails at that point:

test2.pas(46,13) Error: class type expected, but got "CNodeContent"
test2.pas(46,13) Error: Incompatible type for arg no. 2: Got 
"CNodeContent", expected "TObject"

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