I'm new to c++ and this was kinda confusing to me
I was trying to understand some code source where it's doing something like

Using 3 static pointers to 3 classes
allocating that 3 pointers from the main to create new objects to that 3 classes
using them to access members of that instance of classes they created
Why not just use instances ? So they create it on the stack and not the heap without the function scope ? it's already in main
here is the code source

```
int _tmain(int argc, _TCHAR* argv[])
{

...

    SetConsoleTextAttribute(hStdOut, FOREGROUND_CYAN);
    printf("Creating Database... ");
    CDatabaseRoot::Create();
    SetConsoleTextAttribute(hStdOut, FOREGROUND_LIME);
    WriteLn("Completed.");

    SetConsoleTextAttribute(hStdOut, FOREGROUND_CYAN);
    printf("Creating Servers... ");
    CDatabaseRoot::AuthServer->Port = 9958;
    CDatabaseRoot::AuthServer->OnClientConnect = AuthConnect;

```

at the deader of CDatabaseRoot

```
class CDatabaseRoot
{
public:
    static CDatabaseRoot* Core;
    static CServerSocket* AuthServer;
    static CServerSocket* GameServer;
    static void Create();
    static void Destroy();

```

at the cpp

```
CDatabaseRoot* CDatabaseRoot::Core;
CServerSocket* CDatabaseRoot::AuthServer;
CServerSocket* CDatabaseRoot::GameServer;
void CDatabaseRoot::Create()
{
    CDatabaseRoot::Core = new CDatabaseRoot();
    CDatabaseRoot::AuthServer = new CServerSocket();
    CDatabaseRoot::GameServer = new CServerSocket();
}

```

Why is it done this way? Is there a better way to get it done? I would like some explanation please and thanks