Alright I am going in circles here and cannot find a definitive answer to my question online... I have the following classes...

Class A:
Code:
#include classB.h;

classA :
{
public: 
  classA();
  ~classA();

  classB B;
};
Class B:
Code:
#include mutexClass.h
classB :
{
public: 
  classB();
  ~classB();

  mutexClass mutex;
  bool test;
  
};

Mutex:
Code:
#include <pthread.h>
mutexClass :
{
public: 
  mutexClass ();
  ~mutexClass ();

//The (un)lock are basic calls to the pthread to 
//check if its either locked or unlocked...
  lock();   
  unlock();
  
};
MAIN :
Code:
#include "classA.h"

classA = 0;

int main()
{ 
  A = new classA;

  if(A->B.test)
 {do something change bool value}
  if(A->B.mutex.unlock())  //Will check to see if unlocked.
 {do something and lock/unlock}

"more stuff"
I know that was alot of code sorry...
First off; test and/or the mutex are being used within classB to set their value depeding on different criteria. Secondly I am trying to find which would be the best to use. Thirdly I want to do it this way so I have a better understanding of class scope, and class pointers since I am still very uncertain when one should use a class pointer or not..

Now, on to my question. Would calling the mutex in the if statement with the function not being a pointer cause the mutex to lose its value since the destructor is called at the end of class scope that is not a pointer? Also can I access the same data via the if(A->B.test) call or is that value just going to be a default value since when being constructed the value is initialized again without any prior knowledge to its previous value.

Would the value for test carry through or would its value be deleted and reistantiate upon the call from main even if classB set its value to something?