Hi,
I have a class "A" in which I want to have a reference/ pointer to an object of class "B" for usage within the member functions of A.
Currently I do this:
// class A definition
const Crealysm_d3drenderer::CD3dscene* mD3dscene;
// Initial - creation of the renderqueue
bool Create(const Crealysm_d3drenderer::CD3dscene *pD3dscene, const int pLightingEffectId);
// class A implementation
bool CRenderQueue::Create(const Crealysm_d3drenderer::CD3dscene *pD3dscene, const int pLightingEffectId)
{
if(!pD3dscene->IsLoaded()) return false;
if((mD3dscene = pD3dscene) == NULL) return false; // set const pointer to d3dscene
Functionally this all works, but I believe I've only made the pointer const, so the actual pointer is const instead of the object it points to.
Although I'm not sure, because I'm not able to make changes to the objects it points to (pD3dscene).
Can someone clear this up for me?