lundi 30 novembre 2015

Calling function before objects are created in a class

Basically, I have one class that owns another object:

class A()
{
    A() { initSystems() };
    void initSystems();
    B b;
}

class B()
{
    B() { //Does stuff that requires 'initSystems()' to be called before }
}

and for 'B' to function, the init systems function needs to be called in A. Is there any 'nice' way to work around this? Like creating the 'B' object later or something?

Aucun commentaire:

Enregistrer un commentaire