44 lines
1015 B
C++
44 lines
1015 B
C++
//##################################################################
|
|
|
|
// LAB 5
|
|
|
|
// ADVANCED PROGRAMMING IN C++
|
|
|
|
// MATRIX/ARRAY WITH TRY-CATCH
|
|
|
|
//==================================================================
|
|
|
|
// except.h
|
|
|
|
// CLASS IMPLEMENTATION AND DEFINITION FOR
|
|
|
|
// ALL ERRORS
|
|
|
|
// Christian Ohlsson
|
|
|
|
// Daniel Alfredsson
|
|
|
|
// Karlstad 990927
|
|
|
|
//==================================================================
|
|
|
|
|
|
|
|
#ifndef _EXCEPT_H_
|
|
|
|
#define _EXCEPT_H_
|
|
|
|
#include <iostream.h>
|
|
|
|
|
|
|
|
class Error{
|
|
|
|
public:
|
|
|
|
virtual void Print() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RangeError:public Error{
|
|
|
|
public:
|
|
|
|
RangeError() {};
|
|
|
|
void Print() { cout<<"Index out of range.\n"; }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class MemoryError:public Error{
|
|
|
|
public:
|
|
|
|
MemoryError() {};
|
|
|
|
void Print() { cout<<"Could not create object.\n"; }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class SizeError:public Error{
|
|
|
|
public:
|
|
|
|
SizeError() {};
|
|
|
|
void Print() { cout<<"Size doesnt match.\n"; }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif |