C++ Class for Gray Code