Thursday, July 30, 2009

C++ Code to Implement an Abstract Interface ?

In Visual Studio 2005 and using C++, how can I implement the


properties and methods of an abstract interface that I have imported from a type library (.tlb file)? (What functions do I need to call, what pointers do I need to create, etc.) Also, what type of Visual Studio project do I need to create in order to accomplish this?

C++ Code to Implement an Abstract Interface ?
There is no such thing as an Abstract Interface.





Interfaces are not supported with (ISO) C++. You should use an abstract class with only virtual methods.





A .tlb file is (I'm guessing) a Type Library. These are used with COM/ActiveX controls.





Type of Visual Studio project: .... a C++ project I guess





If you are using managed C++, you can just add a reference to the COM object, which should add a RCW you can use (a wrapper around the object referenced). This will do most housekeeping for COM/ActiveX objects for you.
Reply:Here is a resource to do that.


No comments:

Post a Comment