나는 그 클래스에서 파생 된 기본 클래스와 10 클래스가 있습니다. 기본 클래스는 procedure of object
유형의 매개 변수를 제외한 함수를 포함합니다. 이하는 방법 델파이에서 클래스 함수의 구현처럼 일반
mytype = procedure (a : integer) of object;
baseclass = class
public
procedure myproc(cont handler : mytype) ;
end;
procedure baseclass.myproc(cont handler : mytype) ;
begin
// do something
end;
것처럼 같은 기능을 포함하지만, 다른 파라미터 (: 정수) 오브젝트의 수순 (CONST 핸들러)과 유도 수준 즉 파생 클래스에서이 함수의 과부하를하고있다. 등이
base1mytype = procedure (a : string) of object;
derivedclass1 = class(baseclass)
public
procedure myproc(cont handler : base1mytype) ;overload;
end;
base2mytype = procedure (a : boolean) of object;
derivedclass1 = class(baseclass)
public
procedure myproc(cont handler : base2mytype) ;overload;
end;
및 .........처럼
내가이 기능을 구현하는 제네릭 클래스를 원하는 모든 그리고 난 그 함수의 예에서 내 클래스를 파생
mytype = procedure (a : integer) of object;
baseclass<T> = class
public
procedure myproc(cont handler : T) ;
end;
procedure baseclass<T>.myproc(cont handler : T) ;
begin
// do something
end;
and derive classes are like this
deriveclass1 = class<baseclass <string>>
public
procedure myproc(cont handler : T) ;
end;
제네릭 제약 조건 유형의 구속을 지원하지 않습니다
때문에 procedure of object
나는이 모든 것을 아직 읽지 않았지만 코드가 실제 코드가 아니라는 것을 알았습니다. 예 : "cont"는 유효한 키워드가 아닙니다. 웹 브라우저에 입력하는 것이 아닌 실제 코드를 게시하십시오. 그것은 하나의 커다란 오류 원인을 제거합니다. –
"cont"는 const –
입니다. "const"는 의미 한 것이지만 편집기에서 복사하지 않았 음을 사용자가 브라우저에 자유롭게 입력했음을 나타냅니다. 그로 인해 종종 사실과 실제 문제를 모호하게하는 오타가 발생합니다. –