mardi 20 novembre 2018

Is 'this pointer's memory' changed? [on hold]

Toolbar * mtoolbar = new Toolbar(this);
Container * mycontainer = new Container(this);

The above two instance

As a member variable of the View class, I'm going to pass the pointer of the same View object to the respective constructor.

However, when I try to use the debugger, it points to different View instances (they have different memory addresses).

Finally, the View instance that the toolbar points to is different from the View instance that the Container points to.

What I want to do is to point the tool bar instance and the container instance to exactly the same instance.

Aucun commentaire:

Enregistrer un commentaire