Possible Duplicate:
How to cast a Interface to a Object in Delphi
Using Delphi 5; I have an interface that I cannot change for legacy reasons. I am passing (pointers to) that interface all over the place. The implementing class has several new properties - is there a way to force a cast from the interface to the actual implementation?
http://www.malcolmgroves.com/blog/?p=500 says that this is (newly) implemented in Delphi 2010, which strongly suggest that it wasn't possible before. Is this indeed the case, or is there a way I'm not familiar with? RTTI, maybe?
(I checked, and if pScore is TOleScore then
is indeed not allowed by the Delphi 5 compiler - here pScore
is my pScore: IScore
argument, and TOleScore
is the implementing class.)
I think both approaches should work.
Incidentally, does anyone know if Hallvard is still active? I've not come across him in the past few years.