Yurttas/PL/OOL/Cplusplus/F/05/03/00/A.cpp

Revision as of 22:43, 6 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="cpp" line start="1" enclose="div">/* Copyright(C) 2002 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. Perm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  1/*
  2   Copyright(C) 2002
  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   : June 1, 2002.
 11   author : Salih Yurttas.
 12
 13   A.cpp
 14*/
 15
 16
 17#include "A.h"
 18
 19template <class T1,
 20          class T2,
 21          class T3>
 22A<T1,T2,T3>::
 23A(const T1 i,
 24  const T2 j,
 25  const T3 k) : a(i),
 26                b(j),
 27                c(k) {
 28}
 29
 30template <class T1,
 31          class T2,
 32          class T3>
 33T1
 34A<T1,T2,T3>::
 35get_a() const {
 36  return a;
 37}
 38
 39template <class T1,
 40          class T2,
 41          class T3>
 42T2
 43A<T1,T2,T3>::
 44get_b() const {
 45  return b;
 46}
 47
 48template <class T1,
 49          class T2,
 50          class T3>
 51T3
 52A<T1,T2,T3>::
 53get_c() const {
 54  return c;
 55}
 56
 57template <class T1,
 58          class T2,
 59          class T3>
 60T1*
 61A<T1,T2,T3>::
 62get_abc() const {
 63  T1 * l = new T1[3];
 64  l[0] = a;
 65  l[1] = b;
 66  l[2] = c;
 67
 68  return l;
 69}
 70
 71template <class T1,
 72          class T2,
 73          class T3>
 74void
 75A<T1,T2,T3>::
 76set_a(const T1 v) {
 77  a = v;
 78}
 79
 80template <class T1,
 81          class T2,
 82          class T3>
 83void
 84A<T1,T2,T3>::
 85set_b(const T2 v) {
 86  b = v;
 87}
 88
 89template <class T1,
 90          class T2,
 91          class T3>
 92void
 93A<T1,T2,T3>::
 94set_c(const T3 v) {
 95  c = v;
 96}
 97
 98template <class T1,
 99          class T2,
100          class T3>
101void
102A<T1,T2,T3>::
103set_abc(const T1 v) {
104  a = v;
105  b = v;
106  c = v;
107}
108
109template <class T1,
110          class T2,
111          class T3>
112void
113A<T1,T2,T3>::
114set_abc(const T1 u,
115        const T2 v,
116        const T3 w) {
117  a = u;
118  b = v;
119  c = w;
120}
121
122template <class T1,
123          class T2,
124          class T3>
125ostream&
126operator<<(ostream& os,
127           const A<T1,T2,T3>& a) {
128  os << a.a << ' ';
129  os << a.b << ' ';
130  os << a.c;
131  os << endl;
132
133  return os;
134}