PDA

View Full Version : private overloaded assignment operator (not implemented yet?)



AirPas
17-02-2012, 08:17 PM
if you declare overloaded assignment operator as private this means that u can not assign the same type to it . it didn't work in my delphi 2006 i mean even i decalre the assignment operator as private , the compiler allow the assignement .


type
t_type = record
private
class operator Implicit(v : t_type):t_type;
public
x : longword;
end;

class operator t_type.Implicit(v: t_type): t_type;
begin
//
end;
var
t1,t2 : t_type;
begin
t1.x := 10;
t2 := t1 // should be wrong because its private

writeln(t2.x) ;// this print 10
end.
//