Copy a generics list from a class to other.
i have a small problem. I have two class:

    type
      MyClass1 = class
      private
        oMyList: TMyList
      public
        property MyList: TMyList read oMyList;
      end;

and:

    type
      MyClass2 = class
      private
        oMyList: TMyList
      public
        property MyList: TMyList write oMyList;
      end;

I want copy MyList from MyClass1 to MyClass2 and i do:

    ...
      MyClass2.MyList := MyClass1.MyList;
    ...

if i do: 

    writeln (MyClass2.MyList.Count) 

i read number of element on MyList correctly. If i try to do same in class: MyClass2 for example:

    ...
    procedure MyClass2.GetInfo
    begin
      writeln (oMyList.Count);
    end;
    ...

it raise this error: **"Access violation at address XXXXXXXX in module 'XXXXXXXXXX'. Read of address: XXXXXXXX."**.
So i don't understood as i can solve, not find error.
So i ask, as i can copy a Generics List from a class to other?
Thanks again for help.






Copy a generics list from a class to other.
===

i have a small problem. I have two class:

    type
      MyClass1 = class
      private
        oMyList: TMyList
      public
        property MyList: TMyList read oMyList;
      end;

and:

    type
      MyClass2 = class
      private
        oMyList: TMyList
      public
        property MyList: TMyList write oMyList;
      end;

I want copy MyList from MyClass1 to MyClass2 and i do:

    ...
      MyClass2.MyList := MyClass1.MyList;
    ...

if i do: 

    writeln (MyClass2.MyList.Count) 

i read number of element on MyList correctly. If i try to do same in class: MyClass2 for example:

    ...
    procedure MyClass2.GetInfo
    begin
      writeln (oMyList.Count);
    end;
    ...

it raise this error: **"Access violation at address XXXXXXXX in module 'XXXXXXXXXX'. Read of address: XXXXXXXX."**.
So i don't understood as i can solve, not find error.
So i ask, as i can copy a Generics List from a class to other?
Thanks again for help.





