Yurttas/PL/OOL/Cplusplus/F/03/01/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::
20D(const int a,
21  const int b) : i1(a),
22                 i2(b) {
23}
24
25D::
26D(const D& d) : i1(d.i1),
27                i2(d.i2) {
28}
29
30int
31D::
32get_i1() const {
33  return i1;
34}
35
36int
37D::
38get_i2() const {
39  return i2;
40}
41
42int*
43D::
44get_i1_i2() const {
45  int * t = new int[2];
46
47  t[0]=i1;
48  t[1]=i2;
49
50  return t;
51}
52
53void
54D::
55set_i1_i2(const int a) {
56  i1=a;
57  i2=a;
58}
59
60void
61D::
62set_i1_i2(const int a,
63          const int b) {
64  i1=a;
65  i2=b;
66}
67
68void
69D::
70set_i1_i2(const int* a) {
71  i1=a[0];
72  i2=a[1];
73}
74
75ostream& operator<<(ostream& os,
76                    const D& d) {
77  os << endl;
78  os << d.i1 << endl;
79  os << d.i2 << endl;
80  os << endl;
81
82  return os;
83}