How to have access to the members of a class
-
Hi everybody I have written an ATL 3.0 project including two sample classes named CAttachment & CAttachments. These classes have interfaces IAttachment & IAttachments in order. IAttachments has got a method named "Item" that returns a result of the type of IAttachment. But before returning the IAttachment, I want to call some member functions of the CAttachment class to setup the IAttachment properly. I know how to create the IAttachment interface, but I don't know how to have access to the members of the CAttachment from the Item method. I will be thankful if anybody replies to me. Regards, Roozbeh.
-
Hi everybody I have written an ATL 3.0 project including two sample classes named CAttachment & CAttachments. These classes have interfaces IAttachment & IAttachments in order. IAttachments has got a method named "Item" that returns a result of the type of IAttachment. But before returning the IAttachment, I want to call some member functions of the CAttachment class to setup the IAttachment properly. I know how to create the IAttachment interface, but I don't know how to have access to the members of the CAttachment from the Item method. I will be thankful if anybody replies to me. Regards, Roozbeh.
It's a hack but you could cast your
IAttachment
interface toCAttachment
and call the methods you desire.CAttachment a = (CAttachment)piAttachment; a->SomeMethodNotExposedInIAttachment(); pi->SomeMethodExposedByIAttachment();
Note, this won't work outside your implementation project as outside callers won't have access to the
CAttachment
class or any of its members not exposed by theIAttachment
interface.Ian Mariano - http://www.ian-space.com/
"We are all wave equations in the information matrix of the universe" - me -
Hi everybody I have written an ATL 3.0 project including two sample classes named CAttachment & CAttachments. These classes have interfaces IAttachment & IAttachments in order. IAttachments has got a method named "Item" that returns a result of the type of IAttachment. But before returning the IAttachment, I want to call some member functions of the CAttachment class to setup the IAttachment properly. I know how to create the IAttachment interface, but I don't know how to have access to the members of the CAttachment from the Item method. I will be thankful if anybody replies to me. Regards, Roozbeh.