If TChild implemented IChild directly, then this would normally be possible because TChild would implement the method directly AND as part of the IChild interface. ![]() Is not going to work because TChild does not have a method " DoSomething". TChild(Parent).DoSomething // << This is wrong The problem is not in the interface declarations or class implementations, but in your consumer code: procedure CallDoSomething(Parent: TParent) Nevermind, this doesn't work around anything. TM圜lass: TM圜lass = class(TInterfacedObject, IChild, IParent) I can work around this by explicitly including IParent in the class declaration of Despite this the compiler is unable to resolve members of the IParent when the class is instantiated and used. Its clear that the compiler is enforcing the interface inheritance because neither class will compile unless the members of IParent are implemented. I would think that this would allow you to call DoSomething but this doesn't seem to be the case: procedure CallDoSomething(Parent: TParent) TChildDelegate = class(TInterfacedObject, IChild) Property ChildDelegate:IChild read FChildDelegate implements IChild ![]() Assume you have the following: //Note the original example I posted didn't reproduce the problem so
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |