Hallo und Willkommen im Land der Objektorientierung
Du leitest einfach TProt2 von TProt1 ab:
Delphi-Quellcode:
type
TProt1 = class
protected
procedure MachWasAB; virtual;
public
constructor create; virtual;
procedure Send(const Buf : Array of byte); virtual;
procedure Verarbeite; virtual;
end;
TProt2 = class(TProt1)
protected
procedure MachWasABC; override;
public
constructor create; override;
procedure Send(Const Buf : Array of Byte); override;
procedure Verarbeite; override;
end;
Var
ClientList: TObjectList<TProt1>;
oder erstellst eine (abstrakte) Oberklasse:
Delphi-Quellcode:
type
TProt = class abstract
protected
procedure MachWasAB; virtual; abstract;
public
procedure Send(const Buf : Array of byte); virtual; abstract;
procedure Verarbeite; virtual; abstract;
end;
TProt1 = class(TProt)
protected
procedure MachWasAB; override;
public
constructor create; virtual;
procedure Send(const Buf : Array of byte); override;
procedure Verarbeite; override;
end;
TProt2 = class(TProt1)
protected
procedure MachWasABC; override;
public
constructor create; override;
procedure Send(Const Buf : Array of Byte); override;
procedure Verarbeite; override;
end;
Var
ClientList: TObjectList<TProt>;
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."