Re: about casting
Hello!
Thanks a lot for you answer.
You have been of great help!
I have two more questions that I hope to be answered.
Assume we have a class MyTest like this
class MyTest
{
....
IHandle_DS* m_handle_ds;
....
};
Question numer 1.
Can I for example assign the passed handle_ds pointer of type IHandle_DS in
class MyTest shown above like this
in InitRules2
MyTest* myTest = new MyTest();
myTest->m_handle_ds = handle_ds
Question numer 2.
In this class Handle_DS I have two object defined like this
CDataSource DS;
CSession Session;
Is it any restiction when I want to use these for example passing this
Session object into another method named foo
Could I for example do
foo(handle_ds->Session);
//Tony
"Giovanni Dicanio" <giovanniDOTdicanio@REMOVEMEgmail.com> skrev i
meddelandet news:%23E%23m7skVJHA.4456@TK2MSFTNGP06.phx.gbl...
"Tony Johansson" <johansson.andersson@telia.com> ha scritto nel messaggio
news:F_VZk.4585$U5.34390@newsb.telia.net...
I just want to know if it's possible to do this in any way
Handle_DS* m_handle_DS = handle_ds;
see my question below.
Normally in standard C++ doing this would be perfect legal
Handle_DS* m_handle_DS = handle_ds;
COM is not C++ :)
In your code handle_ds was a pointer to the COM interface IHandle_DS.
So, you can't do that kind of cast.
What you can do is just calling the methods of the IHandle_DS interface
from the handle_ds pointer:
// IHandle_DS * handle_ds
// Suppose that IHandle_DS COM interface has a DoSomething() method:
HRESULT result = handle_ds->DoSomething(... parameters );
if ( FAILED(result) )
... error
HTH,
Giovanni