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