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 B.cpp
14*/
15
16
17#include "B.h"
18
19B::
20B(const int a) {
21 d = new int[N];
22
23 for(int i=0; i<N; ++i)
24 d[i] = a;
25}
26
27B::
28B(const B& a) {
29 d = new int[N];
30
31 for(int i=0; i<N; ++i)
32 d[i] = a.d[i];
33}
34
35B&
36B::
37operator=(const B& a) {
38 if(this==&a) return *this;
39
40 for(int i=0; i<N; ++i)
41 d[i] = a.d[i];
42
43 return *this;
44}
45
46B::
47~B() {
48 delete [] d;
49}
50
51int*
52B::
53get_d() const {
54 return d;
55}
56
57void
58B::
59set_d(const int a) {
60 for(int i=0; i<N; ++i)
61 d[i] = a;
62}
63
64void
65B::
66set_d(const int a,
67 const int b) {
68 d[0] = a;
69 d[1] = b;
70}
71
72void
73B::
74set_d(const int* a) {
75 for(int i=0; i<N; ++i)
76 d[i] = a[i];
77}
78
79ostream& operator<<(ostream& os,
80 const B& a) {
81 for(int i=0; i<a.N; ++i)
82 os << a.d[i] << endl;
83
84 os << endl;
85
86 return os;
87}