Yurttas/PL/OOL/Cplusplus/F/05/10/11/R.cpp

 1/*
 2   Copyright(C) 2005
 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   : September 1, 2005.
11   authorĀ : Salih Yurttas.
12
13   R.cpp
14*/
15
16
17#include "N.h"
18
19using namespace N;
20
21template<class T>
22R<T>::
23R() : P<T>() {
24}
25
26template<class T>
27R<T>::
28R(const R<T>& o) {
29  P<T>::a = o.a;
30}
31
32template<class T>
33R<T>&
34R<T>::
35operator=(const R<T>& o) {
36  if(this==&o) return *this;
37
38  P<T>::a = o.a;
39
40  return *this;
41}
42
43template<class T>
44T
45R<T>::
46get_a(const int i) const {
47  return P<T>::a.at(i);
48}
49
50template<class T>
51void
52R<T>::
53set_a(const int size,
54      const T value) {
55  P<T>::a.clear();
56  for(int i=0; i<size; ++i)
57    P<T>::a.push_back(value);
58}
59
60template<class T>
61void
62R<T>::
63output() const {
64  int n = P<T>::a.size();
65  for(int i=0; i<n; ++i)
66    cout << P<T>::a.at(i) << endl;
67  cout << endl;
68}