Results 1 to 1 of 1

Thread: private overloaded assignment operator (not implemented yet?)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    private overloaded assignment operator (not implemented yet?)

    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 .
    Code:
    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.
    //
    Last edited by AirPas; 17-02-2012 at 08:27 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •