I can describe my problem only throug a sample code. Sorry for that.
I've a class inherited through IUnknown (and I want to hide some members):
//a1.h
#define _INTERFACE(IName) interface DECLSPEC_NOVTABLE IName : public IUnknown
#define _INTERFACE_(IName, IBase) interface DECLSPEC_NOVTABLE IName : public IBase
_INTERFACE(A1)
{
//AddRef(), Release(), QueryInterface() come here!
void A1_Func(float y);
};
////////// end of a1.h /////////////
//a1.cpp
struct A1_D : public A1
{
/* AddRef(), Release() and QueryInterface() definitons come here! */
float x;
ULONG _ref_count
};
inline A1_D* CImpl (A1* ptr) { return ( A1*)ptr; }
inline const A1_D* CImpl (const A1* ptr) { return (const A1*)ptr; }
void A1_Func(float y)
{
A1_D* pA1_D = CImpl(this);
pA1_D->x = y;
}
////////// end of a1.cpp /////////////
Now I want a class inherited through A1:
//a2.h
_INTERFACE_(A2, A1)
{
void A2_Func();
};
////////// end of a2.h /////////////
//a2.cpp
struct A2_D : public A2
{
/* AddRef() etc. definitons come here! */
};
It seems that A2::A1_Func() does not work properly.
How can I do this?
Hope I could explain.
Thanks in advance.
-R