Write a definition for an exception class, E, that contains an error number and a string type error name. Include a constructor that creates an E object and initializes both members. Provide accessors for both the message and error number.
What will be an ideal response?
```
#include
using namespace std;
class E
{
public:
E(int theError, string theMessage);
string what();
int errorNumber();
private:
int errorNo;
string message;
};
int E::errorNumber()
{
return errorNo;
}
string E::what()
{
return message;
}
E::E(int Err, string Msg) : errorNo(theError),
message(theMessage){/*empty*/}
```
You might also like to view...
Which of the following processes guarantees that packets are ordered properly and protects against missing segments?
A. watchdog B. keep-alive C. handshake D. sequence and acknowledgment
You can create a new style to apply a set of formats to a table by using the ________ dialog box
A) Style Inspector B) Create New Style from Formatting C) Manage Styles D) Style Pane Options
____ containers are implemented as dynamic arrays in such a way that the elements can be inserted at both ends.
A. Queue B. Deque C. Stack D. Hash table
What Windows Server 2016 technology combines the benefit of solid state drives with the low cost and high capacity of hard disk drives?
A. Storage tiering B. Simple space C. Disk pooling D. Storage layouts