home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-11-29 | 1.3 KB | 61 lines | [TEXT/PJMM] |
- {}
- { File: ObjIntf.p}
- { }
- { Copyright Symantec Corporation 1988}
- { Copyright Apple Computer, Inc. 1986-1987}
- { All rights reserved.}
- {}
-
- unit TObject;
-
- interface
-
- type
- TObject = object
- function ShallowClone: TObject;
- {Lowest level method for copying an object; should not be overridden}
- { except in very unusual cases. Simply calls HandToHand to copy}
- { the object data.}
- function Clone: TObject;
- {Defaults to calling ShallowClone; can be overridden to copy objects}
- { refered to by fields.}
- procedure ShallowFree;
- {Lowest level method for freeing an object; should not be overridden}
- { except in very unusual cases. Simply calls DisposHandle to}
- { free the object data.}
- procedure Free;
- {Defaults to calling ShallowFree; can be overridden to free objects }
- { refered to by fields.}
- end;
-
- implementation
-
- function TObject.ShallowClone;
- var
- result: Handle;
- begin
- result := Handle(SELF);
- if HandToHand(result) <> noErr then
- begin
- { report some sort of error? }
- result := nil
- end;
- ShallowClone := TObject(result);
- end;
-
- function TObject.Clone;
- begin
- Clone := SELF.ShallowClone;
- end;
-
- procedure TObject.ShallowFree;
- begin
- DisposHandle(Handle(SELF));
- end;
-
- procedure TObject.Free;
- begin
- SELF.ShallowFree;
- end;
-
- end.