Q:

Linking pointers to pointers between classes (communicating classes)

I've tried to solve my problem for 2 days now and failed miserably. Internet does not help.
What I'm trying to do is to communicate two classes which reside within another class.
This is my first "big" project so I assume my design is terrible for you guys.
Also, my program is split between a lot of files which may be confusing.
Lets hit it! For the sake readability, I've changed every member to public.
This is my MainOGLController class which is the main class that controls everything my program does:
class MainOGLController
{ // I deleted constructor/destructor from this quote

   public:
        DisplayController*   Display;
        StellarManager*      Manager; // it will need to use something from Display
        void                 RenderScene();
        bool                 CreateNewDisplay(int, char*[]); //  argc argv
}

Ok, this is how i create instance of this class in file with main():
#include "MainOGLController.h"

MainOGLController Controller;

int main(int argc, char* argv[])
{

    if ( Controller.CreateNewDisplay(argc, argv) ) return 1; // if it fails then exit;

// some opengl code here

return 0;
}

Now you are probably wondering how does the CreateNewDisplay method look like:
bool MainOGLController::CreateNewDisplay(int argc, char* argv[])
{
    Display = new DisplayController(argc, argv);
    Manager = new StellarManager(&Display); // me trying to make reference to Display
                                            // to be able to use it within Manager
    //ogl code

    else return 0;
}

OK, so I'm creating Manager there and now we should see how i created the StellarManager class:
class StellarManager
{
        std::vector<Stellar*> VectorManager; // objects from this vector will need to use
                                             // ptrDisplay to access Display

        DisplayController*  ptrDisplay;

        StellarManager(DisplayController&);
        void addEntity();
};

Now for the constructor:
StellarManager::StellarManager(DisplayController& _p) // me trying to do anything
{
    *ptrDisplay = _p;
}

So at this point I should have instance of MainOGLController, and within it, a pointer to DisplayController and StellarController, where StellarController should have its own pointer to the same DisplayController.
Now somewhere withing working piece of code I'm calling the addEntity method:
void StellarManager::addEntity()
{
    VectorManager.push_back(new Stellar(&ptrDisplay); // sending ptrDisplay so that the
                                                      // Stellar object can use it
}

Stellar class is defined like this:
class Stellar
{

    public:
            DisplayController* ptrDisplay;
            Stellar(DisplayController**);
            void Draw(); // finally, heres where i want to use this Display pointer
};

Stellar constructor:
Stellar::Stellar(DisplayController** _p)
{
    *ptrDisplay = **_p;
}

OKAY! Thats the final piece. All i want to do now is simply call method Draw which belongs to Stellar class and use Display which is located in MainOGLController.
Manager->VectorManager[0].Draw();

Oh and the Draw looks just like this:
void Stellar::Draw(int _mode)
{
    GLMatrixStack* mvm = &(ptrDisplay->modelViewMatrix);
    mvm->Scale(2, 0.5, 0.5); // Scale is a method from GLMatrixStack
}

Thats all folks, if theres any better way of doing this, im all ears.
What I did does not work, I'm able to use the *ptrDisplay from Stellar class but nothing happens so I guess I'm not using its reference but a copy.
Sorry, I know this is a lot of code and it may be very confusing. I just dont know what to do now...

A:

It looks like the problem is here:
Stellar::Stellar(DisplayController** _p)
{
    *ptrDisplay = **_p;
}

You're dereferencing a pointer (ptrDisplay) that was never initialized. This results in undefined behavior. I think this captures what you wanted to do:
Stellar::Stellar(DisplayController* _p) : ptrDisplay(_p)
{

}

It's not necessary to pass a pointer-to-pointer-to-DisplayController; all your Stellar class needs is a pointer to a DisplayController. Moreover, it sounds like you don't want to dereference _p and copy it, so simply copying the pointer (via ptrDisplay(_p)) will result in ptrDisplay pointing to the same object as _p. 

