Yurttas/PL/OOL/Cplusplus/F/03/02/06/01/I.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 1998
 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, 1998.
11   author : Salih Yurttas.
12
13   I.cpp
14*/
15
16
17#include "I.h"
18
19I::
20I(const int n) : k(n) {
21}
22
23I::
24I(const I& a) : k(a.k) {
25}
26
27I&
28I::
29operator=(const I& a) {
30  k = a.k;
31  return *this;
32}
33
34bool
35I::
36operator==(const I& a) {
37  if(k==a.k) return true;
38  return false;
39}
40
41I&
42I::
43operator+(const I& a) {
44  k += a.k;
45  return *this;
46}
47
48const I&
49I::
50operator++() {
51  ++k;
52  return *this;
53}
54
55const I
56I::
57operator++(int i) {
58  I t(k);
59  k++;
60  return t;
61}
62
63const I&
64I::
65operator--() {
66  --k;
67  return *this;
68}
69
70const I
71I::
72operator--(int i) {
73  I t(k);
74  k--;
75  return t;
76}
77
78ostream&
79operator<<(ostream& os,
80           const I& a) {
81  os << endl;
82  os << a.k << endl;
83  os << endl;
84
85  return os;
86}