tb0306.pp 596 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {$mode objfpc}
  2. type
  3. tobject2 = class
  4. constructor create;
  5. function rname : string;
  6. procedure wname(const s : string);
  7. property name : string read rname write wname;
  8. end;
  9. tclass2 = class of tobject2;
  10. var
  11. o2 : tobject2;
  12. c2 : tclass2;
  13. constructor tobject2.create;
  14. begin
  15. inherited create;
  16. end;
  17. procedure tobject2.wname(const s : string);
  18. begin
  19. end;
  20. function tobject2.rname : string;
  21. begin
  22. end;
  23. begin
  24. o2:=tobject2.create;
  25. o2.name:='1234';
  26. writeln(o2.name);
  27. o2.destroy;
  28. c2:=tobject2;
  29. o2:=c2.create;
  30. o2.destroy;
  31. end.