Yurttas/PL/OOL/Cplusplus/F/03/01/02/00/a 00.cpp
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 a_00.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "A.h"
22
23int main(int argc, char* argv[]) {
24
25 A a0;
26
27 cout << "initial values after construction-A(int) /" << endl;
28 cout << a0 << endl;
29 cout << endl;
30
31 A a_0(7);
32
33 cout << "initial values after construction-A(int) /" << endl;
34 cout << a_0 << endl;
35 cout << endl;
36
37 int* aa = new int[2];
38
39 aa = a_0.get_d();
40
41 cout << "aa after a_0.get_d() /" << endl;
42 for(int i=0; i<2; ++i)
43 cout << aa[i] << endl;
44
45 cout << endl;
46
47 a_0.set_d(9);
48
49 cout << "a_0 after updated by (9) /" << endl;
50 cout << a_0 << endl;
51 cout << endl;
52
53 A a_1(a_0);
54
55 cout << "initial values after construction-A(A&) /" << endl;
56 cout << a_1 << endl;
57 cout << endl;
58
59 a_1.set_d(3,7);
60
61 cout << "a_1 after updated by (3,7) /" << endl;
62 cout << a_1 << endl;
63 cout << endl;
64
65 a_1.set_d(aa);
66
67 cout << "a_1 after updated by (aa) /" << endl;
68 cout << a_1 << endl;
69 cout << endl;
70
71 a_1 = a_0;
72
73 cout << "a_1 after a_1=a_0 /" << endl;
74 cout << a_1 << endl;
75 cout << endl;
76
77 cout << "a_0 after a_1=a_0 /" << endl;
78 cout << a_0 << endl;
79 cout << endl;
80
81}