Problem overriding ToString of TObject
Original Reporter info from Mantis: leledumbo_cool@yahoo.co.id @leledumbo
-
Reporter name: Mario Ray Mahardhika
Original Reporter info from Mantis: leledumbo_cool@yahoo.co.id @leledumbo
- Reporter name: Mario Ray Mahardhika
Description:
Try this simple unit:
unit TestToString;
{$mode objfpc}{$H+}
interface
type
TMyClass = class
function ToString: String; override;
end;
implementation
function TMyClass.ToString: String;
begin
Result:=inherited;
end;
end.
without override:
TestToString.pas(9,14) Warning: An inherited method is hidden by "TMyClass.ToString:AnsiString;"
with override:
TestToString.pas(16,14) Error: There is no method in an ancestor class to be overridden: "TMyClass.ToString:AnsiString;"
it's declared virtual so it should be overridible.
Mantis conversion info:
- Mantis ID: 15693
- OS: Windows XP SP3
- OS Build: 5.1.2600
- Platform: i386
- Version: 2.5.1
- Fixed in version: 2.6.0
- Fixed in revision: 14869 (#870edaf9)