Yurttas/PL/OOL/Cplusplus/F/04/02/01/00/Q.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 1998
 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   : January 1, 1998.
11   author : Salih Yurttas.
12
13   Q.cpp
14*/
15
16
17#include "Q.h"
18
19Q::
20Q(const int i,
21  const int j) : P(i),
22                 i2(j) {
23}
24
25Q::
26Q(const Q& o) : P(o.i1),
27                i2(o.i2) {
28/* this is also possible
29  i1 = o.i1;
30*/
31}
32
33Q&
34Q::
35operator=(const Q& o) {
36  if(this==&o) return *this;
37
38  i1 = o.i1;
39  i2 = o.i2;
40
41  return *this;
42}
43
44Q::
45~Q() {
46}
47
48int
49Q::
50get_i2() const {
51  return i2;
52}
53
54void
55Q::
56set_i2(const int i) {
57  i2 = i;
58}
59
60ostream&
61operator<<(ostream& os,
62           const Q& q) {
63  os << "Q type :" << endl;
64  os << q.i1 << endl;
65  os << q.i2 << endl;
66  os << endl;
67
68  return os;
69}