Files
Avancerad_CPP/Lab5/except.h
2026-03-05 13:16:26 +01:00

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