灵
灵犀指
Unregistered / Unconfirmed
GUEST, unregistred user!
IMethodRequest =interface
['{614E5F74-B0FD-4A17-92D7-8AC22D84BAFF}']
procedure Call();
end;
TActiveQueue =class
private
Fqueue: TObjectStack;
procedure Setqueue(const Value: TObjectStack);
public
constructor Create()
published
property queue :TObjectStack read Fqueue write Setqueue;
procedure enqueue(mr :IMethodRequest);
function dequeue():IMethodRequest;
end;
function TActiveQueue.dequeue: IMethodRequest;
var
mr:IMethodRequest;
begin
mr :=queue.pop() as IMethodRequest;
result := mr;
end;
由于queue.pop()返回的对象是TObject类型,而函数需要返回IMethodRequest,我该如何改代码?
['{614E5F74-B0FD-4A17-92D7-8AC22D84BAFF}']
procedure Call();
end;
TActiveQueue =class
private
Fqueue: TObjectStack;
procedure Setqueue(const Value: TObjectStack);
public
constructor Create()
published
property queue :TObjectStack read Fqueue write Setqueue;
procedure enqueue(mr :IMethodRequest);
function dequeue():IMethodRequest;
end;
function TActiveQueue.dequeue: IMethodRequest;
var
mr:IMethodRequest;
begin
mr :=queue.pop() as IMethodRequest;
result := mr;
end;
由于queue.pop()返回的对象是TObject类型,而函数需要返回IMethodRequest,我该如何改代码?