ex16.pp 647 B

123456789101112131415161718192021222324
  1. program example16;
  2. { This program demonstrates the PropIsType function }
  3. {$mode objfpc}
  4. uses rttiobj,typinfo;
  5. Var
  6. O : TMyTestObject;
  7. begin
  8. O:=TMyTestObject.Create;
  9. Writeln('Property tests : ');
  10. Write('PropIsType(O,BooleanField,tkBool) : ');
  11. Writeln(PropIsType(O,'BooleanField',tkBool));
  12. Write('PropIsType(Class,BooleanField,tkBool) : ');
  13. Writeln(PropIsType(O.ClassType,'BooleanField',tkBool));
  14. Write('PropIsType(O,ByteField,tkString) : ');
  15. Writeln(PropisType(O,'ByteField',tkString));
  16. Write('PropIsType(Class,ByteField,tkString) : ');
  17. Writeln(PropIsType(O.ClassType,'ByteField',tkString));
  18. O.Free;
  19. end.