Du könntest es auch über ein
overload
regeln:
Delphi-Quellcode:
type
TSrvCmd = (Command1, Command2);
type
TMKCustomClient = class
protected
procedure DoOnServerCommand(ServerCommand : TSrvCmd; Data : TStream); virtual; abstract;
end;
type
TSrvCmd2 = (Command1a, Command2a, Command3, Command4, Command5);
type
TMKChatClient = class(TMKCustomClient)
protected
procedure DoOnServerCommand(ServerCommand : TSrvCmd; Data : TStream); override; overload;
procedure DoOnServerCommand(ServerCommand : TSrvCmd2; Data : TStream); overload;
end;
procedure TMKChatClient.DoOnServerCommand(ServerCommand: TSrvCmd; Data: TStream);
begin
{ hier setzen wir voraus, daß die Ordnungszahlen der ersten beiden Werte von TSrvCmd2 denen von TSrvCmd entsprechen }
DoOnServerCommand(TSrvCmd2(ServerCommand), Data);
end;
procedure TMKChatClient.DoOnServerCommand(ServerCommand: TSrvCmd2; Data: TStream);
begin
case ServerCommand of
Command1a: ;
Command2a: ;
Command3: ;
Command4: ;
Command5: ;
end;
end;