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*/}
```

Computer Science & Information Technology

You might also like to view...

The ________ is also known as the wireless network name

a.domain b.homegroup c.service set identifier d.wireless access point

Computer Science & Information Technology

The __________ operator takes as an argument the type of object being allocated and returns a __________.

a. new, pointer to an object of that type. b. delete, reference to an object of that type. c. delete, copy of the object of that type. d. sizeof, reference to an object of that type.

Computer Science & Information Technology