Hi !
Is there a method to copy an occurence of a type to another (without copy field by field).
Thanks !
See this :
Is there a method to copy an occurence of a type to another (without copy field by field).
Thanks !
See this :
Strict Global My_pixels_list:Tlist = CreateList() Type TPixel Field x Field y Function Create:TPixel (x:Int , y:Int) Local p:TPixel = New TPixel p.x = x p.y = y ListAddLast My_pixels_list , p Return p End Function Function Copy:TPixel (p:TPixel) Local e:TPixel e = p ' <--- i just want copy p e.y = p.y + 10 ' <---- but p is also modified, in fact p.y = e.y, so e isn't a copy of p. ListAddLast My_pixels_list , e Return e End Function Function Draw_all () SetColor 255,255,255 For Local p:TPixel = EachIn My_pixels_list Plot p.x , p.y DebugLog "x=" + p.x DebugLog "y=" + p.y Next End Function End Type Graphics 800 , 600 Local p1:TPixel = TPixel.Create (100 , 100) Local p2:TPixel = TPixel.Copy (p1) While Not KeyDown(KEy_ESCAPE) TPixel.Draw_all() Flip Wend