2
내 레코드 정의를 interface
에 입력하고 ctrl + alt + C을 누르면 Delphi는 다음 스텁을 채 웁니다.클래스 연산자의 컨텍스트에서 상속되는 의미
class operator P<T>.GreaterThan(a, b: P<T>): Boolean;
begin
inherited; <<-- ???
end;
이 컨텍스트에서 inherited
은 무엇을 의미합니까?
그리고 델파이도 일치하지 않습니다 :
인터페이스 :
class operator Implicit(a: pointer): P<T>; inline;
class operator Implicit(a: P<T>): pointer; inline;
class operator Implicit(Cell: TCell<T>): P<T>; inline;
class operator Implicit(P: P<T>): TCell<T>; inline;
구현
:class operator P<T>.Implicit(a: pointer): P<T>;
begin <<--- nothing
end;
class operator P<T>.Implicit(a: P<T>): pointer;
begin
inherited; <<-- now you see it...
end;
class operator P<T>.Implicit(Cell: TCell<T>): P<T>;
begin <<-- now you don't
end;
class operator P<T>.Implicit(P: P<T>): TCell<T>;
begin
end;
델파이는 "선도"로 하나의 연산자를 걸립니다 의심하고 있습니다 (아무 상속) 매개 변수가 호환 가능하다고 결정하면 inherited
루틴의 해당 구현을 따릅니다.
여기에서 inherited
은 무엇을 의미합니까?
보너스 질문
어떤 규칙이 델파이에 따라 않고 피려 pittfalls은 무엇입니까?
좋아, 나는 거기에 같은 클래스 연산자의 여러 오버로드 된 버전과 관련이 있다고 생각. – Johan