I think you want to use a CObject pointer in the function, and then after you get it, cast it to a pointer to your own class that you are mapping before using it, something like: CObject* pObj; GetNextAssoc ( …, … , pObj); CMyClass* pMyClass = (CMyClass*) pObj; There…