Сохраняя изменения простыми, используйте поток строк вместо stdout и возвращайте строку вместо печати на консоль
string Box::getParameters(void)
{
std::stringstream ss;
ss << "\nDepth:" << getDepth(depth) << endl <<
"Width:" << getWidth(width) << endl <<
"Height :" << getHeight(height) << endl;
return ss.str();
}