Yurttas/PL/OOL/Cplusplus/F/05/10/01/P.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 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   P.cpp
14*/
15
16
17#include "N.h"
18
19using namespace N;
20
21template<class T>
22P<T>::
23P() {
24}
25
26template<class T>
27P<T>::
28P(const P<T>& o) : a(o.a) {
29}
30
31template<class T>
32P<T>&
33P<T>::
34operator=(const P<T>& o) {
35  if(this==&o) return *this;
36
37  a = o.a;
38
39  return *this;
40}
41
42template<class T>
43vector<T>
44P<T>::
45get_a() const {
46  return a;
47}
48
49template<class T>
50void
51P<T>::
52set_a(const int i,
53      const T v) {
54  a.at(i) = v;
55}
56
57template<class T>
58void
59P<T>::
60set_a(const vector<T>& v) {
61  a = v;
62}
63
64template<class T>
65void
66P<T>::
67output() const {
68  int n = a.size();
69
70  cout << endl;
71  for(int i=0; i<n; ++i)
72    cout << a.at(i) << endl;
73}