mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 17:48:01 +02:00

a stringconstn is often an arraydef. The result is that they again get the same typeconversion behaviour as string variables, which is important in case of overloaded operators (#9021/#9026) git-svn-id: trunk@8268 -
29 lines
441 B
ObjectPascal
29 lines
441 B
ObjectPascal
operator := (input:extended) output: string;
|
|
begin
|
|
str(round(input),output);
|
|
end;
|
|
|
|
operator + (const s: string; input:extended) output: string;
|
|
begin
|
|
str(round(input),output);
|
|
output:=s+output;
|
|
end;
|
|
|
|
procedure test(a:string);
|
|
begin
|
|
writeln(a);
|
|
if (a <> 'help1') then
|
|
halt(1);
|
|
end;
|
|
|
|
var
|
|
s: string;
|
|
begin
|
|
s:='help';
|
|
test('help'+1);
|
|
test(s+1);
|
|
test(s+1.2);
|
|
test(s+extended(1.2));
|
|
test(s+string(1.2));
|
|
end.
|