Thema: Delphi von Tlist ableiten

Einzelnen Beitrag anzeigen

Benutzerbild von sakura
sakura

Registriert seit: 10. Jun 2002
Ort: München
11.412 Beiträge
 
Delphi 11 Alexandria
 
#6
  Alt 18. Feb 2003, 14:24
Weil Delphi die Klasse TObject automatisch erbt, wenn keine angegeben wird - warum wohl sonst

Zitat von Die Delphi Hilfe:
A class type declaration has the form

type className = class (ancestorClass)
memberList
end;

where className is any valid identifier, (ancestorClass) is optional, and memberList declares members--that is, fields, methods, and properties--of the class. If you omit (ancestorClass), then the new class inherits directly from the predefined TObject class.
P.S. Du solltest immer für den Destructor Destroy die override Direktive setzen, da dieser bereits in TObject als VIRTUAL definiert ist.
Delphi-Quellcode:
// DIE TOBJECT DEFINITION
TObject = class
    constructor Create;
    procedure Free;
    class function InitInstance(Instance: Pointer): TObject;
    procedure CleanupInstance;
    function ClassType: TClass;
    class function ClassName: ShortString;
    class function ClassNameIs(const Name: string): Boolean;
    class function ClassParent: TClass;
    class function ClassInfo: Pointer;
    class function InstanceSize: Longint;
    class function InheritsFrom(AClass: TClass): Boolean;
    class function MethodAddress(const Name: ShortString): Pointer;
    class function MethodName(Address: Pointer): ShortString;
    function FieldAddress(const Name: ShortString): Pointer;
    function GetInterface(const IID: TGUID; out Obj): Boolean;
    class function GetInterfaceEntry(const IID: TGUID): PInterfaceEntry;
    class function GetInterfaceTable: PInterfaceTable;
    function SafeCallException(ExceptObject: TObject;
      ExceptAddr: Pointer): HResult; virtual;
    procedure AfterConstruction; virtual;
    procedure BeforeDestruction; virtual;
    procedure Dispatch(var Message); virtual;
    procedure DefaultHandler(var Message); virtual;
    class function NewInstance: TObject; virtual;
    procedure FreeInstance; virtual;
    destructor Destroy; virtual;
  end;
P.P.S.: Das TObject nicht abgeleitet wird liegt an der, lt. Borland, Compiler-Magic.
Daniel W.
Ich bin nicht zurück, ich tue nur so
  Mit Zitat antworten Zitat