bug0215.pp 911 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. { $OPT=-St }
  2. { allow static keyword }
  3. { submitted by Andrew Wilson }
  4. Program X;
  5. Type
  6. PY=^Y;
  7. Y=Object
  8. A : LongInt;
  9. P : PY; static;
  10. Constructor Init(NewA:LongInt);
  11. Procedure StaticMethod; static;
  12. Procedure VirtualMethod; virtual;
  13. End;
  14. Constructor Y.Init(NewA:LongInt);
  15. Begin
  16. A:=NewA;
  17. P:=@self;
  18. End;
  19. Procedure Y.StaticMethod;
  20. Begin
  21. Writeln(P^.A); // Compiler complains about using A.
  22. P^.VirtualMethod; // Same with the virtual method.
  23. With P^ do begin
  24. Writeln(A); // These two seem to compile, but I
  25. VirtualMethod; // can't get them to work. It seems to
  26. End; // be the same problem as last time, so
  27. End; // I'll check it again when I get the
  28. // new snapshot.
  29. Procedure Y.VirtualMethod;
  30. Begin
  31. Writeln('VirtualMethod');
  32. End;
  33. Begin
  34. End.