implemented and tested object.cpp