-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFixed_Array.cpp
More file actions
62 lines (52 loc) · 1.3 KB
/
Fixed_Array.cpp
File metadata and controls
62 lines (52 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// $Id: Fixed_Array.cpp 827 2011-02-07 14:20:53Z hillj $
// Honor Pledge:
//
// I pledge that I have neither given nor received any help
// on this assignment.
//
// Fixed_Array
//
template <typename T, size_t N>
Fixed_Array <T, N>::Fixed_Array (void)
: Array_Base <T> (N)
{
// nothing needs to be done
} // end default constructor
//
// Fixed_Array
//
template <typename T, size_t N>
Fixed_Array <T, N>::Fixed_Array (const Fixed_Array <T, N> & arr)
: Array_Base <T> (arr) // call the base copy constructor
{
// nothing needs to be done
} // end copy constructor (same sized arrays)
//
// Fixed_Array
//
template <typename T, size_t N>
Fixed_Array <T, N>::Fixed_Array (T fill)
: Array_Base <T> (N, fill)
{
// nothing needs to be done
} // end initialization constructor (with fill)
//
// ~Fixed_Array
//
template <typename T, size_t N>
Fixed_Array <T, N>::~Fixed_Array (void)
{
// no memory allocated in the derived class
// automatically calls the base's destructor
} // end destructor
//
// operator =
//
template <typename T, size_t N>
const Fixed_Array <T, N> & Fixed_Array <T, N>::operator = (const Fixed_Array <T, N> & rhs)
{
for (size_t i = 0; i < N; i++) {
this->data_[i] = rhs.data_[i];
} // end for
return *this;
} // end operator = (same as copy constuctor)