Yurttas/PL/OOL/Cplusplus/F/04/02/01/00/q 01.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 q_01.cpp - [ dynamic testing - proper for virtual member testing ]
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "Q.h"
22
23int main(int argc, char* argv[]) {
24
25 P * p1 = new P;
26
27 cout << "p1 initial values after default construction-P() /" << endl;
28 cout << *p1 << endl;
29
30 cout << "accessors after mutators /" << endl;
31 p1->set_i1(2);
32 cout << p1->get_i1() << endl;
33
34 cout << endl;
35
36 cout << "p1 values after set /" << endl;
37 cout << *p1 << endl;
38
39 delete p1;
40
41 p1 = new Q;
42
43 cout << "p1 initial values after default construction-Q() /" << endl;
44 cout << *p1 << endl;
45
46 p1->set_i1(2);
47
48 cout << "accessors after mutators /" << endl;
49 cout << p1->get_i1() << endl;
50 cout << endl;
51
52 cout << "p1 values after set /" << endl;
53 cout << *p1 << endl;
54
55 delete p1;
56
57 Q * q1 = new Q;
58
59 cout << "q1 initial values after default construction-Q() /" << endl;
60 cout << *q1 << endl;
61
62 q1->set_i1(8);
63 q1->set_i2(9);
64
65 cout << "accessors after mutators /" << endl;
66 cout << q1->get_i1() << endl;
67 cout << q1->get_i2() << endl;
68 cout << endl;
69
70 cout << "q1 values after set /" << endl;
71 cout << *q1 << endl;
72
73 delete q1;
74
75 q1 = new Q(9);
76
77 cout << "q1 initial values after construction-Q(9) /" << endl;
78 cout << *q1 << endl;
79
80 p1 = new Q(*q1);
81
82 cout << "p1 initial values after construction-Q(q1) /" << endl;
83 cout << *p1 << endl;
84
85}