10/07/05 17:31:55
Double, Integer, Byte, Word, ShortIntなどの2値を比較し、その結果を返すような関数を作りたいのですが、
function TCompareClass.chkValProc<TypeID>( const srcVal, dstVal : TypeID ): Boolean;
begin
if ( srcVal < dstVal) then begin
Result := False;
end else begin
Result := True;
end;
end;
イメージ的にこういう感じのメソッドを作る方法ってないもんでしょうか。
↑だと、型が限定されないからか、コンパイルが通りません。
function TCompareClass.chkValProc<TypeID>( const srcVal, dstVal : Double ): Boolean;
function TCompareClass.chkValProc<TypeID>( const srcVal, dstVal : ): Boolean;
function TCompareClass.chkValProc<TypeID>( const srcVal, dstVal : TypeID ): Boolean;