mouse::mouse() { z1=0; speed=20; } mouse::~mouse() { z1=0; } void mouse::record() { t1.push_back(0); t2.push_back(0); t3.push_back(0); doesn't work as in doesn't register inside the class, but mouse::mouse() { z1=0; speed=20; t1.push_back(0); t2.push_back(0); t3.push_back(0); // t1-t3 are vector } mouse::~mouse() { z1=0; } void mouse::record() { does work, and registers the values correctly (throws a 0) into the three fields