const T * const addNewRecord(T data) throw (MemoryError,IOError);
this is function declared in header file T is template and MemoryError,IOError is Exception handling functions
template const T * const Table::addNewRecord() (T record) throw (MemoryError,IOError)
{
T * newRecord = new T (record);
if(!newRecord)
{
throw new MemoryError();
}
newRecord->recordId = this->getNextRecordId();
this->records->push_back(newRecord);
try
{
this->writeTofile();
}
catch (IOError error)
{
//clean up things
this->records->pop_back();
delete newRecord;
//rethrow exception
throw;
}
return newRecord;
}
this is funtion declared in CPP file .And its showing error mention in title in function name (addRecord) and not picking up the MemoryError,IOError functions and dynamic exception error in throw
Ansh Kapil is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.