delphi - 在不修改接口(interface)的情况下将delphi接口(interface)转换为其实现类

标签 delphi interface delphi-5

<分区>

Possible Duplicate:
How to cast a Interface to a Object in Delphi

使用德尔福 5;我有一个界面,由于遗留原因无法更改。我到处传递(指向)该接口(interface)。实现类有几个新属性 - 有没有办法强制从接口(interface)强制转换为实际实现?

http://www.malcolmgroves.com/blog/?p=500说这是(新)在 Delphi 2010 中实现的,这强烈表明这在以前是不可能的。确实是这样吗,还是有什么我不熟悉的方法?也许是 RTTI?

(我检查过,Delphi 5 编译器确实不允许 if pScore is TOleScore then - 这里 pScore 是我的 pScore: IScore 参数,TOleScore 是实现类。)

最佳答案

我认为这两种方法都应该有效。


顺便说一句,有人知道 Hallvard 是否仍然活跃吗?过去几年我没见过他。

关于delphi - 在不修改接口(interface)的情况下将delphi接口(interface)转换为其实现类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6414496/

相关文章:

java : advanced inheritance to jpa

mysql - 如何在 SQL 中裁剪字段长度,使其不占用 DBGrid 的所有空间?

delphi - 使用关联程序打开文件

c# - Activator.CreateInstance 有两个接口(interface)

C# 将类类型作为参数传递

Delphi 5 - TField 上的尺寸不匹配

delphi - delphi中的记事本问题

delphi - 如果我不在完全 Debug模式下使用 FastMM4,它是否比 Delphi XE2 中的内存管理器快?

mysql - Delphi 2009 + Zeos + MySQL DBGrid 将字符串显示为 (BYTES)