Yurttas/PL/OOL/Cplusplus/F/02/06/05/Exception.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2000
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : January 1, 2000.
11   author : Salih Yurttas.
12
13   Exception.cpp
14*/
15
16
17#include "Exception.h"
18
19Exception::
20Exception(const string& why) : reason(why) {}
21
22Exception::
23Exception(const Exception& why) : reason(why.reason) {}
24
25void
26Exception::
27operator=(const Exception& e) {
28  reason=e.reason;
29}
30
31Exception::
32operator string() {
33  return reason;
34}
35
36ostream&
37operator<<(ostream& os,
38           Exception& e) {
39  os << "Exception : " << string(e) << endl;
40}