tbug772.pp 395 B

12345678910111213141516171819202122232425262728
  1. type tFoo = object
  2. a:integer;
  3. constructor Create;
  4. procedure ReadA;
  5. procedure ShowA;
  6. end;
  7. constructor tFoo.Create;
  8. begin
  9. a:=0;
  10. end;
  11. procedure tFoo.ReadA;
  12. begin
  13. write('a: '); Readln(a);
  14. end;
  15. procedure tFoo.ShowA;
  16. begin
  17. writeln('A=',a);
  18. end;
  19. var Foo:tFoo;
  20. begin
  21. Foo.Create;
  22. Foo.ReadA; {this leaves Foo.a untouched, but it should'nt}
  23. Foo.ShowA;
  24. end.