I have been working on a program that uses 2 memory blocks, one of which is recalled from the previous program in the same file. The "tReg" program is suppose to use the "FallingEdgeDet". the code i have so far is posted bellow. It does not work mainly because of the incorrect way I am trying to call the previous program. A little back round to make this easier to understand, The input of the program is "T" the output of the FallingEdgeDet in the "tReg" program is "U" the memory block of the FallingEdgeDet in the "tReg" is "F" the input to the 2nd memory of the "tReg" is the output of the entire program "Q". This memory block is labeled "M" the output of "M" is "R", "R" and "U" go into an XOR gate which has the proper programing.
// function: Falling Edge Detector
class FallingEdgeDet {
bool M;
public:
FallingEdgeDet() {
M = 0;
}
void operator () (bool A, bool & Z) {
bool C;
C = M;
Z = !A&&C;
M = A;

}
};

//test function FallingEdgeDet
void testFallingEdgeDet () {
FallingEdgeDet M;
bool A, Z;
char ans;
while (
cout<<"would you like to test?",
cin>>ans,
ans=='y'
)
{
cin>>A;
M(A,Z);
cout<<Z<<endl;
}
}

//Toggle Register

class tReg {
bool FallingEdgeDet(), M;
public:
tReg(){
M = 0;
}
void operator () (bool T, bool & Q){
bool U, R;
FallingEdgeDet(F(T,U));
R = M;
Q = U!=R;
M = Q;

}
};