Exceptions handling in cpp, C/C++ Programming

Exceptions. Your SVector class should throw four exceptions: 3.1. If the constructor size is invalid, then it will just allow the implicit STL bad_alloc exception to pass up to main().

3.2. If the string index is invalid, then it should explicitly throw an STL range_error exception.

3.3. If the SVector is empty when a pop_back is called because the vector is empty, then it should throw an underflow exception of the STL.

3.4. If the string used for push_back is a duplicate then your class will throw an exception of a class named Whoops that you write in SVector.h that has a constructor, and a what() method.

3.5. Your function definitions should indicate what type of exception they throw.

3.6. You can find information about the STL exceptions at:

3.7. assert 3.7.1.You must add assertions that would catch the three explicit SVector exceptions of 3.2, 3.3, and 3.4 before they reach the throw statements.

3.8. Makefile 3.8.1.Your Makefile should have a "all:" rule that compiles both p8.out with the NDEBUG defined using the D option of g++, and p8b.out that compiles without NDEBUG defined so that the asserts will work.

3.8.2.You need not compile a mainB.o file for this assignment, so only two lines are needed to create each executable.

 

Posted Date: 3/6/2013 2:51:52 AM | Location : United States







Related Discussions:- Exceptions handling in cpp, Assignment Help, Ask Question on Exceptions handling in cpp, Get Answer, Expert's Help, Exceptions handling in cpp Discussions

Write discussion on Exceptions handling in cpp
Your posts are moderated
Related Questions
Explain Register Variable Computers have internal registers, which are used to keep data temporarily, before any operation can be performed. Intermediate results of the calcula

d county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Necklaces

c program to implement least cost method

Problem Statement: You have to write a C program to develop a Car Parking Management System for a busy commercial area. The system will record the car plate number, date and time w

Explain some String Oriented Library Functions? To make simpler string processing we can use special string oriented library functions. Mainly the C compilers include library f

how to create a flowchart? can you help me in my assignment about flowcharting ....

Is it legal for a member function to say delete this? A: As long as you're cautious, it's OK for an object to delete this. Here's how I define "cautious": You have to be a

When you are designing a generic class to have or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or

#include #include #include #include #include class Employee { private: char *Name; //Set them as pointers... int IdNumber; char *Department; char *Position; public: voi

Each function has its own stack frame between %fp and %sp. Let Caller calls Callee. Then Caller's %sp becomes callee's %fp, and callee's %sp set to be a new value (a smaller one be