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

Revision as of 22:48, 6 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="cpp" line start="1" enclose="div">/* Copyright(C) 2007 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. Perm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 1/*
 2   Copyright(C) 2007
 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   : December 1, 2007.
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>
65ostream& operator<<(ostream& os,
66                    const P<T>& o) {
67  int n = o.a.size();
68
69  os << endl;
70  for(int i=0; i<n; ++i)
71    os << o.a.at(i) << endl;
72
73  return os;
74}