Interface - Class
-
How to convert interface object to its class? I have an interface object say IMarkSet. I passed to an COM function. There i need to access a function which takes CMarkedSet . Thanks
Mohan
-
How to convert interface object to its class? I have an interface object say IMarkSet. I passed to an COM function. There i need to access a function which takes CMarkedSet . Thanks
Mohan
AnanyaMohan wrote:
I have an interface object say IMarkSet. I passed to an COM function. There i need to access a function which takes CMarkedSet . ^ | v How to convert interface object to its class?
The answer is really simple: you don't. The reason may be a bit more complicated.... This is a design flaw either in your class or the interfaces it exposes and perhaps even a combination. This is all about abstraction and encapsulation. A COM object/server exposes several interfaces that can be used to alter the behaviour and/or state of the server. Whatever the server is supposed to do, it must be possible to trigger it through the interfaces. Perhaps you need to query for another interface, or even implement an additional interface, but that's all right; it's supposed to work that way. But how the server accomplishes its task is entirely up to the server and is encapsulated behind interfaces. In short: you have to re-evaluate your design.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
How to convert interface object to its class? I have an interface object say IMarkSet. I passed to an COM function. There i need to access a function which takes CMarkedSet . Thanks
Mohan
AnanyaMohan wrote:
There i need to access a function which takes CMarkedSet
That simply is wrong thing, you are trying to do. Always talk through interface.