void IfPushPop(){ if ( truthTable[ truthTable.size()-2 ] ) truthTable[ truthTable.size()-1 ] = !truthTable[ truthTable.size() ]; else truthTable[ truthTable.size()-1 ] = 0; };
Yep, there's a bad index in there. You've got undefined behaviour there, which means that it can "seem to work" sometimes, too.
As noted, make use of .back(). If you need the element before that, you have the options that were provided, but again, be careful that the element is there. (Actually, you'll need at least one element in order to get .back().)
Also, C++ provides a real boolean type, called bool. Why not really use it (i.e. actually store booleans and compare them "naturally"; and refer to the values "true" and "false" when returning)?
Also, please get out of this habit of using weird prefixes like "If". Use namespaces instead. (And give your class a better name than "IfClass", which is effectively just calling it "Class").
Also, printing a class that way is not very flexible. The standard C++ idiom is something like this:
friend ostream& operator<< (ostream& os, const IfClass& ic) { // I'll keep your name for now :s for ( int i=0; i < truthTable.size(); i++ ) os << truthTable; } return os;}
Now calling code can do print the object "naturally" as if it were any built-in type: std::cout << myInstance << ", which allows for chaining" << std::endl;.