Hello,
Starting on page 212 about overloading the assignment operator the Reference Guide gives an example starting with the definition of a complex data type as:
type
complex = record
re : real;
im : real;
end;
then states "This system can be used to declare a new type, and define an assignment for that type. For instance, to be able to assign a newly defined type ’Complex’ "
Var
C, Z : Complex; // New type complex
begin
Z := C; // assignments between complex types.
end;
followed by: "The following assignment operator would have to be defined:"
Operator := (C : Complex) z : complex;
but that makes the compiler unhappy, outputting the error message:
"Error: impossible to overload assignment for equal types"
which makes sense since the overload in that case is unnecessary.
Is the example faulty or am I missing its point ?
I also checked the ucomplex unit to see if an assignment operator was defined for a (complex, complex) tuple and there wasn't one. That example is at least confusing.
Thank you for your help.