Hi
Hi
I have decided, finally, to try out interfaces. I read about it for few weeks and today I was ready to start coding.
Well, I got stuck pretty fast. I was planning to replace a base class - derived class technique with an interface.
The problem I have is it seems that when the interface is implemented thru a TComponent, you need to implement yourself the TInterfacedObject and prevent the reference counting in few area.
Is it what I need to do or am I missing something. It seems so easy to do it with TInterfacedObject but not as easy if you still what it to be a component.
What is the right way to implement an interface with a component? Is it to create 2 classed, one from TComponent only and one from TInterfacedObject? and then the component creates the interface?
Any examples would be great.
Thank you
Marco
I have decided, finally, to try out interfaces. I read about it for few weeks and today I was ready to start coding.
Well, I got stuck pretty fast. I was planning to replace a base class - derived class technique with an interface.
The problem I have is it seems that when the interface is implemented thru a TComponent, you need to implement yourself the TInterfacedObject and prevent the reference counting in few area.
Is it what I need to do or am I missing something. It seems so easy to do it with TInterfacedObject but not as easy if you still what it to be a component.
What is the right way to implement an interface with a component? Is it to create 2 classed, one from TComponent only and one from TInterfacedObject? and then the component creates the interface?
Any examples would be great.
Thank you
Marco
Comments
Post a Comment