Yurttas/PL/OOL/Cplusplus/F/03/01/00/D.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   D.cpp
14*/
15
16
17#include "D.h"
18
19D::D() : i0(0),
20         i1(0),
21         i2(0) {
22}
23
24D::D(const int i) : i0(i),
25                    i1(i+1),
26                    i2(i+2) {
27}
28
29D::D(const D& d) : i0(d.i0),
30                   i1(d.i1),
31                   i2(d.i2) {
32}
33
34int D::get_i1() const {
35  return i1;
36}
37
38int D::get_i2() const {
39  return i2;
40}
41
42void D::set_i1_i2(const int i) {
43  i1+=i;
44  i2-=i;
45}
46
47ostream& operator<<(ostream& os,
48                    const D& d) {
49  os << endl;
50  os << d.i0 << endl;
51  os << d.i1 << endl;
52  os << d.i2 << endl;
53  os << endl;
54
55  return os;
56}