0
는 다음 코드를 살펴 :이 당신이 객체의 deepcopy 복제를 할 것 어떻게 생각하고Delphi Prism :이 deepcopy 또는 shallowcopy입니까?
method TMakerRect.Clone: TMakerObject;
var
newRect:TMakerRect;
begin
newRect := new TMakerRect(bounds,myForm);
newRect.Assign(Self);
newRect.theBrushStyle := Self.theBrushStyle;
Result := newRect;
end;
method TMakerGraphic.Assign(obj:TMakerObject);
begin
inherited Assign(obj);
if obj is TMakerGraphic then
begin
thePen:=TmakerGraphic(obj).thePen;
FillColor:=TMakerGraphic(obj).fillColor;
dynamics:=TmakerGraphic(obj).dynamics;
end;
end;
. 그것이 사실이라면,이 객체들은 마치 별도의 객체처럼 행동해야하지만, 그렇지 않습니다. 예를 들어 테 펜의 너비를 변경할 때마다 원본 개체의 테 이펜 너비도 변경됩니다. 도와주세요.
미리 감사드립니다.
romkyns :
가 대신
의이 같은 각각의 특성, 뭔가 복제해야 우수함, 그것을 작동합니다. 고맙습니다. – ThN