Yurttas/PL/OOL/Cplusplus/F/04/02/02/00/r 01.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   r_01.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "R.h"
22
23int main(int argc, char* argv[]) {
24
25  R r1;
26
27  cout << "r1 initial values after default construction-R() /" << endl;
28  cout << r1 << endl;
29  cout << endl;
30
31  cout << "accessors after mutators /" << endl;
32  r1.set_i1(2);
33  cout << r1.get_i1() << endl;
34  r1.set_i2(4);
35  cout << r1.get_i2() << endl;
36  r1.set_i3(1);
37  cout << r1.get_i3() << endl;
38  cout << endl;
39
40  cout << "r1 values after set ops /" << endl;
41  cout << r1 << endl;
42  cout << endl;
43
44  R* r2 = new R;
45
46  cout << "r2 initial values after 'new' default construction-R() /" << endl;
47  cout << *r2 << endl;
48  cout << endl;
49
50  // destructor for r1 is implicitly called but not for r2!
51
52}