blob: b98badf1cfc495f916512a87cba8ebd677f82a15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
{ %FAIL }
{$mode objfpc}
Program test;
uses crt;
type
TMatrix = class
Constructor Create;
private
Elements : array [1..10,1..10] of real;
end;
Constructor TMatrix.Create;
begin
end;
OPERATOR :=(r:Real):TMatrix;
BEGIN
WITH RESULT DO
BEGIN
{ Do something }
END;
writeln ('Call to overloaded operator :=, real operand');
END;
operator :=(m : TMatrix):TMatrix;
BEGIN
WITH RESULT DO
BEGIN
{ Do something }
END;
writeln ('Call to overloaded operator :=, matrix operand');
END;
var
m : TMatrix;
m2 : TMatrix;
begin
clrscr;
writeln ('Performing calculations...');
m:=TMatrix.Create;
m2:=TMatrix.Create;
writeln ('Assigning real to matrix...');
{ This one works }
m:=1;
writeln ('Assigning matrix to matrix...');
{ This one does not work }
m:=m2;
writeln ('Done.');
end.
|