Well, you don't post the constructor, so we can't help you with that. However, there are a couple things I noticed:
Code:
// NEVER, EVER call the destructor like
box->~switchbox()
//It's much better to use:
delete box;
// readports can be simplified:
bool switchbox::readPorts(int port)//this gets the input values from the program switchbox
{
return DigitalInput(port).Get();
}
// bin2dec is accessing invalid array boundries:
// You have an array[3], but you access 1 2 3.
// Change those to 0 1 2
// Actually, the entire function can be simplified:
int switchbox::bin2dec(bool bit[3])
{
return (bit[0] | (bit[1] << 1) | (bit[2] << 2));
}
// The for loop in switchbox::Get() will get four bools, but you're trying to store them in an array of 3.